Reputation: 91
I have a grid that have a header "Show All" which shows all columns and "Hide All" which hides all except the default first column. Here's my code to hide one of the column by header name, but how would I go about hiding all at the same time?
var grid = Ext.ComponentQuery.query('grid[itemId=gridID]')[0];
var column = grid.getColumnManager();
column.getHeaderByDataIndex("columnDataIndexName").setVisible("true/false");
Upvotes: 0
Views: 145
Reputation: 91
Ext.Array.each(grid.getColumns(), function(column, index) {
if (index > 0) {
column.setVisible(false);
}
}, this);
Upvotes: 1