Retaining column state in grid panel depending on the user settings.

Posted by xrx215 on Stack Overflow See other posts from Stack Overflow or by xrx215
Published on 2010-05-03T19:32:20Z Indexed on 2010/05/03 19:38 UTC
Read the original article Hit count: 205

Filed under:

Hi,

I have a grid panel where I am retaining the state of the columns.It works fine for all the columns except one where i show or hide the column depending on user settings.

If a checkbox is checked then i show the column in grid panel else hide it.

In the column model I have defined the column as follows

   var colModel = new Ext.grid.ColumnModel([{ header: xppo.st('SDE_RESPONSIBILITY_ACTION1'), width: 80, sortable: true, hidden: !showColumn, hideable: !showInMenu, dataIndex: 'ResponsibilityForAction' }}

In the grid panel I have given the following

if (showColumn) {

grid.getColumnModel().setHidden(23, false);

}

else {

grid.getColumnModel().setHidden(23, true);

}

so i change the value of the checkbox column in the column header is shown (alowing the user to enable and disable in grid panel) or completely not shown in the column menu.

So when the column in column menu does not exists it should no longer show that particular column in grid panel.But because I am retaining the state of the grid panel even though the column in column menu does not exists this particular column retains the state i.e it is still shown in grid panel.

My question is how can we show or hide columns in grid panel like the way we do in column model.??

© Stack Overflow or respective owner

Related posts about extjs