First of all, there is no such thing as a column in terms of the DOM. There are a bunch of cells ( div and td actualy) that have the same class name:
-------------------------------------------------- -----------------
| div # gridcolumn-1018 | div # gridcolumn-1019 |
| ------------------------------------------------- ---------------- |
| td.x-grid-cell-gridcolumn-1018 | td.x-grid-cell-gridcolumn-1019 |
| td.x-grid-cell-gridcolumn-1018 | td.x-grid-cell-gridcolumn-1019 |
| td.x-grid-cell-gridcolumn-1018 | td.x-grid-cell-gridcolumn-1019 |
| ... | ... |
-------------------------------------------------- -----------------
So, when you do something like:
grid.columns[1].addCls('myCls');
you add the class to div#gridcolumn-1019 , but not to all other cells in the column.
So, in order to add a class to all cells of a column while hiding the columns, you should do something like this:
grid.column[1].on('hide', function(column){ var id = column.getId(); // gridcolumn-1019 var cells = Ext.DomQuery.select('.x-grid-cell-'+id); column.addCls('myCls'); for (var i = 0; i < cells.length; i++) Ext.fly(cells[i]).addCls('myCls'); }
UPDATE: changed invalid cells[i].addCls('myCls'); to fix Ext.fly(cells[i]).addCls('myCls');
source share