Results 1 to 4 of 4

Thread: How to get grid click column name on extjs4?

  1. #1
    Sencha User
    Join Date
    Jul 2008
    Posts
    20
    Vote Rating
    1
      0  

    Default Answered: How to get grid click column name on extjs4?

    How can i get the click column name on extjs4's grid.
    in the 2.x, i can use grid.getColumnModel().getColumnId(columnIndex).
    but in 4.x, getColumnModel() disappeared.

  2. Hi,

    try to use this:

    Code:
    alert(grid.ownerCt.columns[cellIndex].text)
    in your code you are getting the view of the gridpanel instead of gridpanel

  3. #2
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,335
    Answers
    124
    Vote Rating
    93
      0  

    Default

    Hi,

    you can try following code

    Code:
     yourgrid.getSelectionModel().addListener('select', function (selModel, record, row, column, eOpts) {
                            alert(yourgrid.columns[column].text);
                        });
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  4. #3
    Sencha User
    Join Date
    Jul 2008
    Posts
    20
    Vote Rating
    1
      0  

    Default

    will get error of : grid.columns is undefined
    my code like this:
    controller:
    'quotationQuotationPanel > gridpanel':{celldblclick: this.gridDbClick},
    ......

    gridDbClick: function(grid, td, cellIndex, record, tr, rowIndex, e, oPts){
    alert(grid.columns[cellIndex].text); //get error: grid.columns is undefined
    return;
    }

  5. #4
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,335
    Answers
    124
    Vote Rating
    93
      0  

    Default

    Hi,

    try to use this:

    Code:
    alert(grid.ownerCt.columns[cellIndex].text)
    in your code you are getting the view of the gridpanel instead of gridpanel
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •