PDA

View Full Version : StateProvider not load the correct state



foxmarco
20 Sep 2011, 7:05 AM
if you set stateful true into the grid and you set an StateProvider there is a problem becouse if you set remoteSort true into the store of a grid panel the state has no effect.

index.jsp



var hp = Ext.create('Ext.ux.state.HttpProvider', {
url : 'stateController.do',
user : 'pippo',
session : flowExecutionKey,
id : 'institute',
readBaseParams : {cmd:'readState'},
saveBaseParams : {cmd:'saveState'},
autoRead : false
});

Ext.state.Manager.setProvider(hp);








Ext.onReady(function(){


Ext.state.Manager.getProvider().initState([{"name":"grid-stateId-atmSite","value":"o%3Acollapsed%3Db%253A0%5Ecolumns%3Da%253Ao%25253Aid%25253Ds%2525253Ah1%255Eo%25253Aid%25253Ds%2525253Ah2%255Eo%25253Aid%25253Ds%2525253Ah3%255Eo%25253Aid%25253Ds%2525253Ah4%255Eo%25253Aid%25253Ds%2525253Ah5%255Eo%25253Aid%25253Ds%2525253Ah6%255Eo%25253Aid%25253Ds%2525253Ah7%255Eo%25253Aid%25253Ds%2525253Ah8%255Eo%25253Aid%25253Ds%2525253Ah9%255Eo%25253Aid%25253Ds%2525253Ah10%25255Esortable%25253Db%2525253A0%25255Ewidth%25253Dn%2525253A88%5Efilters%3Do%253Astatus%253Da%25253As%2525253AD%25255Es%2525253AC"},{"name":"grid-pippo","value":"o%3Acollapsed%3Db%253A0%5Ecolumns%3Da%253Ao%25253Aid%25253Ds%2525253Ah1%255Eo%25253Aid%25253Ds%2525253Ah2%255Eo%25253Aid%25253Ds%2525253Ah3%255Eo%25253Aid%25253Ds%2525253Ah4%255Eo%25253Aid%25253Ds%2525253Ah5%255Eo%25253Aid%25253Ds%2525253Ah6%255Eo%25253Aid%25253Ds%2525253Ah7%255Eo%25253Aid%25253Ds%2525253Ah8%5Esort%3Do%253Aproperty%253Ds%25253Aid%255Edirection%253Ds%25253AASC"},{"name":"grid-stateId-atm","value":"o%3Acollapsed%3Db%253A0%5Eflex%3Dn%253A1%5Ecolumns%3Da%253Ao%25253Aid%25253Ds%2525253Ah1%255Eo%25253Aid%25253Ds%2525253Ah2%255Eo%25253Aid%25253Ds%2525253Ah3%255Eo%25253Aid%25253Ds%2525253Ah4%255Eo%25253Aid%25253Ds%2525253Ah5%255Eo%25253Aid%25253Ds%2525253Ah6%255Eo%25253Aid%25253Ds%2525253Ah7%25255Esortable%25253Db%2525253A0%25255Ewidth%25253Dn%2525253A46%5Esort%3Do%253Aproperty%253Ds%25253Aid_atm%255Edirection%253Ds%25253AASC"},{"name":"grid-stateId-institute","value":"o%3Acollapsed%3Db%253A0%5Ewidth%3Dn%253A1264%5Eheight%3Dn%253A676%5Ecolumns%3Da%253Ao%25253Aid%25253Ds%2525253Ah1%255Eo%25253Aid%25253Ds%2525253Ah2%255Eo%25253Aid%25253Ds%2525253Ah3%25255Ewidth%25253Dn%2525253A138%255Eo%25253Aid%25253Ds%2525253Ah4%25255Ewidth%25253Dn%2525253A78%255Eo%25253Aid%25253Ds%2525253Ah5%255Eo%25253Aid%25253Ds%2525253Ah6%255Eo%25253Aid%25253Ds%2525253Ah7%255Eo%25253Aid%25253Ds%2525253Ah8%5Esort%3Do%253Aproperty%253Ds%25253Aid%255Edirection%253Ds%25253AASC"}]);

Ext.define('institute', {
extend: 'Ext.data.Model',
fields: [
{name: 'id'},
{name: 'description'},
{name: 'codAbi'},
{name: 'codAbiDrv'},
{name: 'codSoa'},
{name: 'codClone'},
{name: 'codSocieta'},
{name: 'enable'}
],
idProperty: 'id'
});
var store = Ext.create('Ext.data.Store', {
storeId:'instituteStore',
model: 'institute',
sorters : {property: 'id', direction: "ASC"},
autoLoad: true,
proxy: {
type : 'ajax',
url : 'url.do',
reader : Ext.create("Ext.data.reader.Json",{
type : 'json',
root : 'data',
totalProperty : 'results'
})
},
remoteSort: true
});


Ext.create('Ext.grid.Panel', {
title: 'Institute',
store: store,
columns: [
...
...
],
height: 200,
width: 500,
renderTo: Ext.getBody(),
stateId : 'grid-stateId-institute',
stateful: true
});
});



If you comment the remoteSort everything work. I suppose this is a bug.