开发者

extjs combo:How to set user selected value as the default selected value next time?

In extjs combo box, I have this requirement: When the user selects an option from the combo, capture it, and next time page is loaded and combo is init-ed, set the value(both value and displayvalue) to the user's last selection. I can get the user selected index by :Combo.selectedIndex, but how do we set this index back when the page loads next time?

Or is t开发者_运维问答here another solution?


This is very very rough but the way I would do it:

var comboStore = new Ext.data.Store({
    ...
    autoLoad: false,
    ...
});

var combo = new Ext.form.ComboBox({
    ...
    store: comboStore,
    ...
    listeners: {
       select: function() {
           ...use getValue() and save here...
       }
    }
});

comboStore.on("load",function() {
    ...load value here...
    combo.setValue(loaded value);
},this,{single: true});

comboStore.reload();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜