The default stateEvents are ["columnmove", "columnresize", "sortchange"] and initStateEvents also adds a saveState to the colModel 'hiddenchange' event. Also, getState returns hidden state for columns and applyState applies the hidden state correctly.
So the grid should store the column hidden states!
Thanks for the tip about id-s.
Now that I have the unique id-s set up the default stateEvents namely - columnresize, columnmove and sortchange work correctly. However, the hiddenchange state handling - saving information about hidden/showed columns, isn't working.
Your code to register a hiddenchange event is missing a scope. But you should remove it anyway, because the hiddenchange event handler is already registered in initStateEvents (with a delay of 100ms).
Sorry, I didn't put it clearly in my previous post. I am getting the result of hide/show information not being saved with stateEvents and initStateEvents declaration removed.
Hi Condor,
I fingered what my mistake was.
The application I am developing has several grid objects, and one function for creating a grid. For every grid I was passing the distinct GridPanel parameters, such as columns, store, etc.. but initializing with same stateId. So the cookies were being saved not for each grid but for the mixed up structure. I kept wandering why my changes in one of the grid would propogate to all others.
Setting the stateId property unique for each grid solved my problem - hidden columns information is being saved in cookies for each grid.
Thank you very much for your help.
Restore stateful Grid Columns on click of a button
Restore stateful Grid Columns on click of a button
Hi,
In a grid Panel, i would like to have a button "Restore Default" clicking on which it should remove columns which are hided and saved in the cookies and refresh the Grid back to the original state. Can anyone tell me how can i do this?
I would like this button as well. How can I insert it on the dropdown menu of every column?
Originally Posted by Slb
Hi,
In a grid Panel, i would like to have a button "Restore Default" clicking on which it should remove columns which are hided and saved in the cookies and refresh the Grid back to the original state. Can anyone tell me how can i do this?