Ext中下拉列表ComboBox組件store數據格式用法介紹_extjs
來源:懂視網
責編:小采
時間:2020-11-27 21:12:01
Ext中下拉列表ComboBox組件store數據格式用法介紹_extjs
Ext中下拉列表ComboBox組件store數據格式用法介紹_extjs: 代碼如下: var p_years = new Ext.form.ComboBox( { fieldLabel : '統計年份', anchor : anchor_w, mode : 'remote', maxHeight:100, triggerAction : 'all', selectOnFocus : true, forceSelectio
導讀Ext中下拉列表ComboBox組件store數據格式用法介紹_extjs: 代碼如下: var p_years = new Ext.form.ComboBox( { fieldLabel : '統計年份', anchor : anchor_w, mode : 'remote', maxHeight:100, triggerAction : 'all', selectOnFocus : true, forceSelectio

代碼如下:
var p_years = new Ext.form.ComboBox( {
fieldLabel : '統計年份',
anchor : anchor_w,
mode : 'remote',
maxHeight:100,
triggerAction : 'all',
selectOnFocus : true,
forceSelection : true,
editable : false,
//store :[['11', '2011'], ['12', '2012'],['13', '2013']] //此為第一種
store:[2011,2012,2013,2014,2015,2016,2017,2018] //此為第二種,當沒有制定value和text的時候,默認提交值與顯示值為同一個。
});
在該組件中,可以直接手寫數組格式[ [' value','Text ' ] ,[ ],[ ] ]進行構建,提交值是前者,后者作為顯示值。
下面是比較正規用法,從數據庫同步數據字典渲染comboBox組件
代碼如下:
var proj_main_store = new Ext.data.JsonStore({
url : "************",
fields : ['TEXT', 'VALUE'],
root : "objs",
baseParams : {
"obj/dicttypeid" : "BM_IMPORTANT_PROJ"
}
});
proj_main_store.addListener("load", function(){
proj_main_store.insert(0, new Ext.data.Record({
'TEXT' : '全部',
'VALUE' : ""
}));
});
var proj_main_type = new Ext.form.ComboBox( {
fieldLabel : '重點工程',
anchor : anchor_w,
mode : 'remote',
triggerAction : 'all',
selectOnFocus : true,
forceSelection : true,
editable : false,
valueField : 'VALUE',
displayField : 'TEXT',
store : proj_main_store
});
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
Ext中下拉列表ComboBox組件store數據格式用法介紹_extjs
Ext中下拉列表ComboBox組件store數據格式用法介紹_extjs: 代碼如下: var p_years = new Ext.form.ComboBox( { fieldLabel : '統計年份', anchor : anchor_w, mode : 'remote', maxHeight:100, triggerAction : 'all', selectOnFocus : true, forceSelectio