PDA

View Full Version : Extjs 4.2 Stateful grid on Ext.window.Window



Valera777
2 Jun 2017, 10:45 PM
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:


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":"lisa@simpsons.com", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"bart@simpsons.com", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"home@simpsons.com", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"marge@simpsons.com", "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();
}
}
})
]
});
})

Gary Schlosberg
5 Jun 2017, 11:07 AM
Which specific version of Ext JS 4.2 are you using? You code seems to recall the sorting I selected. How is it failing for you?

Valera777
6 Jun 2017, 8:24 AM
Version is 4.2.2.1144. I replaced columns and changed them size. But state (size,orders) of the columns do not restore. I thought that if 'stateId' do not change the state of grid columns must be restore when window opens

Gary Schlosberg
6 Jun 2017, 3:55 PM
Ah, I see that now. Looks like a bug which isn't fixed until 6.0.1. I searched for a matching bug ticket to see about a workaround but couldn't find one.

Valera777
6 Jun 2017, 10:22 PM
Could you make the bug ticket at the sencha bugtracker? Or i need do it myself? Is it possible that the bug will be fixed because version is 4.2 (4.2 is old version)?

Gary Schlosberg
9 Jun 2017, 1:25 PM
Support for Ext JS 4.x ended on December 31st, 2016.