PDA

View Full Version : Combobox save-restore state



Shura1245
20 Oct 2011, 11:41 AM
Hello everybody,

I have problem. I cant save and then restore value for ExtJS 4 Combobox via stateful (data is dynamic and loading from DB).

I see created cookie with correct value but looks like that on combo creation the stateful value is loaded before loading full list from DB....

Can anyone advise?

Shura1245
22 Oct 2011, 11:15 AM
Any Idea?

Shura1245
25 Oct 2011, 10:18 AM
Any one ?

miroperez
28 Dec 2011, 2:33 PM
I'm not sure of your exact need but you have to have these in your combobox config:



{
stateId: 'foo',
stateEvents: ['change'], // and whatever else you need
getState: function() {
return {value: this.getValue()};
},
applyState: function(state) {
this.setValue(state.value);
}
}



Hope this helps,
Miro

devtig
8 May 2012, 12:54 AM
Don't forget to add this for Ext JS 4.1.0 if you want your field to be stateful:

stateful: true

Ext JS 4.0.7 didn't need it to be stateful if other state properties were set.