user2353513
user2353513

Reputation: 189

get column index of hide column in extjs grid panel

I need to get column index of hide column in extjs grid panel

columnhide: function() {
            var cell = this.getEl().query('.x-grid-cell-inner');

            for(var i = 0; i < cell.length; i++) {
            if (i%2 != 0){  // Instead of this i, want to change the style to none for the  hide column, so i need to get the column index of hide column in grid panel
                    cell[i].style.display= "none";
                }
            }

Upvotes: 1

Views: 4715

Answers (1)

Zero Cool
Zero Cool

Reputation: 1936

Using the columnhide listener:

columnhide: function(ct, column, eOpts) {
    alert(column.getIndex());
},

Alternatively, you could loop through the grid columns and check the isHidden() property on each column:

Ext.each(grid.columns, function(column, index) {
   if (column.isHidden()) {
       alert('column at index ' + index + ' is hidden');
   }
});

I have a test case set up here: http://jsfiddle.net/cCEh2/

Upvotes: 3

Related Questions