PDA

View Full Version : How to get the current columns in the grid ?



renganathan
16 Feb 2012, 2:58 AM
Hi all,

In grid , we can show / hide any columns . How to get the current showing columns in the script?


Is there any way to get the currently showing columns?


Please help me to get the current columns.

Please refer the following image ....


31756

friend
16 Feb 2012, 4:09 AM
Use can use Ext.ComponentQuery to return an array of Column objects that have hidden set to true:


var arrayOfHiddenColumnObjects = Ext.ComponentQuery.query('yourgridwidgetname gridcolumn[hidden="true"]');

mbharathiraj
16 Feb 2012, 8:11 AM
To get the visible columns you have to use getVisibleGridColumns() method from Ext.grid.header.Container.



var visibleColumns = gridObj.headerCt.getVisibleGridColumns();
alert(visibleColumns[0].text);

renganathan
1 Mar 2012, 1:24 AM
Thanks for your reply. its working fine