I try to use the following two version of code to save the last state of the combobox's state, but it doesn't work(applyState never get hit), any one experience this? I used extjs 2.2 library, thanks in advance!
Version1:
Code:
var combo = new Ext.form.ComboBox({
        id: 'myCombo',
        //emptyText: 'Select one please',
        title: 'Please select one...',
        store: ['Foo','Bar'],
        displayField: 'name',
        valueField: 'name',
		mode: 'local',
        triggerAction: 'all',
		lazyInit: false,
		forceSelection: true,
        editable: false,
		plugins: [
            new Ext.ux.plugins.FitToContainer({
                width_adjust: -28,
                x_adjust: 6,
                y_adjust: 1,
                hideFirst: true,
                height: false
            })
        ],
        stateful: true,
		stateId: 'myCombostate',
        stateEvents: ['select'],
        getState: function(){return {value: this.getValue()};},
        applyState: function(state) {this.setValue(state.value);}
    });


Ext.onReady(function() {
Ext.QuickTips.init();
Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); 


 var win = new Ext.Window({ 
id:'combo-win' 
,title:'test'
,layout:'fit' 
,width:280 
,height:360 
,closable:false 
,border:false 
,items:combo 
}); 


win.show(); 




});
Version2:
Code:


var combo = new Ext.form.ComboBox({
        id: 'myCombo',
        //emptyText: 'Select one please',
        title: 'Please select one...',
        store: ['Foo','Bar'],
        displayField: 'name',
        valueField: 'name',
		mode: 'local',
        triggerAction: 'all',
		lazyInit: false,
		forceSelection: true,
        editable: false,
		plugins: [
            new Ext.ux.plugins.FitToContainer({
                width_adjust: -28,
                x_adjust: 6,
                y_adjust: 1,
                hideFirst: true,
                height: false
            })
        ],
        stateful: true,
		stateId: 'myCombostate',
        stateEvents: ['select'],
        getState: function() {
            return {
                selectedIndex: this.getValue()
            };
        },
        applyState: function(state) {
            this.onLoad = this.onLoad.createSequence(function() {
                this.selectByValue(state.selectedIndex);
            },this);
        }
    });


Ext.onReady(function() {
Ext.QuickTips.init();
Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); 


 var win = new Ext.Window({ 
id:'combo-win' 
,title:'test'
,layout:'fit' 
,width:280 
,height:360 
,closable:false 
,border:false 
,items:combo 
}); 


win.show(); 




});