PDA

View Full Version : Save grid state problems with plugins like GridFilters and CheckColumn



pouniok
12 Apr 2010, 5:17 AM
Hi,

I'm currently trying to add an HttpProvider to save my grids states all over my app. It's working very well and very simply, but I'm facing 2 problems when I try to save filters and checkColumn states.

1) First problem : CheckColumn.

The CheckColumn from the edit grid example http://www.extjs.com/deploy/dev/examples/grid/edit-grid.html is a little renderer that adds mousedown event to check/uncheck checkboxes.

Now, let's say that I move my check column that was in 3rd place, to the 1st place. The state is saved, and I'm reopening my grid to see what happend.

When I call :

Ext.state.Manager.getProvider().initState([here are my params...]);

I can see that my grid ColumnModel is good : the check column appears in 1st place in this object definition. But on my screen, the column hasn't moved. So I think I'm forgetting something like a refresh ? (Tried gridView() refreshes at different places but didn't seems to work.)


2) My second problem : GridFilters.

It's a good plugin that adds filters to the column header menu. They are well saved by the provider, but when I try to restore the state I get this error :

grid.filters.filters is undefined


I'm stuck here for about 2 days and I wanted to know if someone could give me a clue. I searched a lot and didn't find anything about that.

If it can help, here is my provider, and grid definition



Ext.state.Manager.setProvider(new Ext.ux.state.HttpProvider({
url:prefixVar+'setUserPrefs.do'
,readBaseParams:{action:'readState'}
,saveBaseParams:{action:'saveState'}
,autoRead:false
}));

Ext.state.Manager.getProvider().initState(
[{"name":"listOT","value":"o%3Acolumns%3Da%253Ao%25253Aid%25253Dn%2525253A0%25255Ewidth%25253Dn%2525253A62%255Eo%25253Aid%25253Dn%2525253A1%25255Ewidth%25253Dn%2525253A88%255Eo%25253Aid%25253Dn%2525253A7%25255Ewidth%25253Dn%2525253A179%255Eo%25253Aid%25253Dn%2525253A2%25255Ewidth%25253Dn%2525253A71%255Eo%25253Aid%25253Dn%2525253A3%25255Ewidth%25253Dn%2525253A48%255Eo%25253Aid%25253Dn%2525253A4%25255Ewidth%25253Dn%2525253A62%255Eo%25253Aid%25253Dn%2525253A5%25255Ewidth%25253Dn%2525253A71%255Eo%25253Aid%25253Dn%2525253A6%25255Ewidth%25253Dn%2525253A223%255Eo%25253Aid%25253Ds%2525253Aext-gen60%25255Ewidth%25253Dn%2525253A39%255Eo%25253Aid%25253Dn%2525253A9%25255Ewidth%25253Dn%2525253A10%25255Ehidden%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A10%25255Ewidth%25253Dn%2525253A10%25255Ehidden%25253Db%2525253A1%5Esort%3Do%253Afield%253Ds%25253Aot_code%255Edirection%253Ds%25253ADESC%5Efilters%3Do%253A"}]
);

var grid = new Ext.grid.EditorGridPanel({
store : dslistOT_1271076665867,
sm : sm,
cm : cm,
stateId: 'listOT',
stateful: true,
stateEvents: ['columnmove', 'columnresize'],
clicksToEdit : 2,
stripeRows : true,
region : 'center',
loadMask: true,
view : new Ext.grid.GroupingView({
forceFit : true,
templates: {
header: headerTpl
},
groupTextTp1 : '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
}),
enableColumnHide : true,
plugins : [filters,checkColumnot_pep]
});


Thank you,
Pou.