PDA

View Full Version : Is there a simple way to get Visible Column from a grid panel?



sliks
15 Dec 2011, 12:05 PM
As title said, I would like to have an array of visible column. Is there a simple way to do that?

Grid.columns returns all the columns. So that's not I want, I only want the visible column.

Grid.columns[0].getVisibleColumn() returns an empty array, which make perfect sense too, but that's not I want either. Is there a easy way to do that?

sliks
15 Dec 2011, 12:37 PM
Nevermind
I figured it out. Any other solutions are still welcome


Ext.each(grid.columns, function(col, index) {
if (!col.hidden){
columnsBuffer.push(col.text);
}
});

Animal
15 Dec 2011, 2:36 PM
This is what ComponentQuery (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.ComponentQuery) was conceived for.

Generally it would be



myGrid.query('gridcolumn:not([hidden])')


If you had grouped headers, and wanted only the ones at the base which corresponded to actual data columns:



myGrid.query('gridcolumn:not([hidden]):not([isGroupHeader])')