Hi everyone.My Extjs version is 4.2. I try save state of the grid, which is item of window.When I close window state of the grid save in cookies, but it don't restore when window open again. What did I miss?
This is my code:
Code:
Ext.onReady(function(){
Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));
Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data:{'items':[
{ 'name': 'Lisa', "email":"[email protected]", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"[email protected]", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"[email protected]", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"[email protected]", "phone":"555-222-1254" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});
Ext.create('Ext.container.Viewport', {
items: [
Ext.create('Ext.Button', {
text: 'Click me',
listeners:{
'click':function(){
var grid = Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone' }
],
stateful:true,
stateId:'some_state_id'
});
var win = Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 900,
layout: 'fit',
items: grid
});
win.show();
}
}
})
]
});
})