Ext中下拉列表ComboBox組件store數(shù)據(jù)格式用法介紹
更新時(shí)間:2013年07月15日 16:54:41 作者:
本文為大家詳細(xì)介紹下Ext中下拉列表ComboBox組件store數(shù)據(jù)格式的基本用法,感興趣的朋友可以參考下哈,希望對(duì)大家有所幫助
復(fù)制代碼 代碼如下:
var p_years = new Ext.form.ComboBox( {
fieldLabel : '統(tǒng)計(jì)年份',
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] //此為第二種,當(dāng)沒(méi)有制定value和text的時(shí)候,默認(rèn)提交值與顯示值為同一個(gè)。
});
在該組件中,可以直接手寫數(shù)組格式[ [' value','Text ' ] ,[ ],[ ] ]進(jìn)行構(gòu)建,提交值是前者,后者作為顯示值。
下面是比較正規(guī)用法,從數(shù)據(jù)庫(kù)同步數(shù)據(jù)字典渲染comboBox組件
復(fù)制代碼 代碼如下:
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 : '重點(diǎn)工程',
anchor : anchor_w,
mode : 'remote',
triggerAction : 'all',
selectOnFocus : true,
forceSelection : true,
editable : false,
valueField : 'VALUE',
displayField : 'TEXT',
store : proj_main_store
});
相關(guān)文章
extjs grid設(shè)置某列背景顏色和字體顏色的方法
extjs grid設(shè)置某列背景顏色和字體顏色的方法,需要的朋友可以參考下。2010-09-09Ext對(duì)基本類型的擴(kuò)展 ext,extjs,format
Ext對(duì)基本類型的擴(kuò)展 ext,extjs,format,學(xué)習(xí)extjs的朋友可以參考下。2010-12-12EXTJS內(nèi)使用ACTIVEX控件引起崩潰問(wèn)題的解決方法
在本人目前的項(xiàng)目中,前端部分完全使用EXTJS基于“One-Page”理念搭建。2010-03-03EXTJS FORM HIDDEN TEXTFIELD 賦值 使用value不好用的問(wèn)題
用了一個(gè)方法解決了此問(wèn)題,但是老是感覺這樣解決了很不爽,各位有沒(méi)有遇到過(guò)這種問(wèn)題,請(qǐng)指點(diǎn)一下。2011-04-04Extjs3.0 checkboxGroup 動(dòng)態(tài)添加item實(shí)現(xiàn)思路
Extjs3.0中的CheckboxGroup默認(rèn)不能動(dòng)態(tài)添加item,如需要數(shù)據(jù)動(dòng)態(tài)創(chuàng)建,試著創(chuàng)建整個(gè)CheckboxGroup,而不是動(dòng)態(tài)添加item,具體實(shí)現(xiàn)如下,感興趣的朋友可以了解下2013-08-08