[英]extjs combo:How to set user selected value as the default selected value next time?
在extjs組合框中,我有以下要求:當用戶從組合中選擇一個選項時,將其捕獲,並在下次加載頁面並初始化組合時,將值(值和displayvalue)設置為用戶的最后選擇。 我可以通過Combo.selectedIndex
獲取用戶選擇的索引,但是當頁面下次加載時如何設置該索引呢?
還是有其他解決方案?
這非常非常粗糙,但是我會這樣做:
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();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.