-
11 Aug 2008 9:18 AM #1
[2.x][CLOSED] GridPanel applyState: Hidden doesn't hide column header
[2.x][CLOSED] GridPanel applyState: Hidden doesn't hide column header
I'm not sure whether others have noticed this as well or not. In couple of my cases, I noticed that when a column is hidden in the stored state and state is restored on a rendered grid, grid headers remain visible while content is hidden. I propose the following fix:
Code:Ext.grid.GridPanel.override({ applyState : function(state){ var cm = this.colModel; var cs = state.columns; if(cs){ for(var i = 0, len = cs.length; i < len; i++){ var s = cs[i]; var c = cm.getColumnById(s.id); if(c){ c.width = s.width; var oldIndex = cm.getIndexById(s.id); cm.setHidden(oldIndex, s.hidden); if(oldIndex != i){ cm.moveColumn(oldIndex, i); } } } } if(state.sort){ this.store[this.store.remoteSort ? 'setDefaultSort' : 'sort'](state.sort.field, state.sort.direction); } } });
-
23 Sep 2008 10:30 PM #2
I'm assuming you are on an older version. That code has had this since at least 2.1 and seems to work fine:
Code:if(c){ c.hidden = s.hidden; c.width = s.width;
-
24 Sep 2008 5:10 AM #3
Brian, column model does change but there are no updates on the screen in this case. So, is it by design that we must call grid.getView().refresh(true)?
-
24 Sep 2008 5:24 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
@brian:
You assume that applyState is only called with the state from the state manager when the component is created.
However, several people use getState and applyState to save and restore column layout (e.g. a "Restore columns" button).
This means that applyState can also be called when the grid is already rendered.
-
14 Sep 2009 2:20 AM #5
Restore stateful Grid Columns on click of a button
Restore stateful Grid Columns on click of a button
i have given Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
and " stateful: true," to save the columns of grid in cookies and get those. I would like to have a button for the grid which will restore all the columns. Can you pls guide me how can i use the applyState in the restore buttton?
-
7 Jun 2012 12:46 AM #6


Reply With Quote