//獲取系統(tǒng)配置項(xiàng)下拉列表 function GetSysConfigComboBox(groupId, inputName, fieldLabel, value, disabled) { var store = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: "SysConfigAction.ashx?action=list&groupid=" + groupId }), reader: new Ext.data.JsonReader( { root: "" }, Ext.data.Record.create(["Value", "Remark"]) ) }); var combo = new Ext.form.ComboBox({ store: store, hiddenName: inputName, //提交到后臺(tái)的input名稱 valueField: 'Value', displayField: 'Remark', //store字段中你要顯示的字段,多字段必選參數(shù),默認(rèn)當(dāng)mode為remote時(shí)displayField為undefine,當(dāng)select列表時(shí)displayField為"text" mode: 'local', //因?yàn)閐ata已經(jīng)取數(shù)據(jù)到本地了,所以'local',默認(rèn)為"remote",枚舉完 triggerAction: 'all', //很重要 emptyText: '請(qǐng)選擇...', editable: false, fieldLabel: fieldLabel //設(shè)置表單中顯示的標(biāo)簽 }); store.on('load', function() { //數(shù)據(jù)加載完成后設(shè)置下拉框值 if (value) combo.setValue(value); combo.disabled = disabled; }); store.load(); return combo; }
---------------------
轉(zhuǎn)自 https://blog.csdn.net/ranbolwb/article/details/7347374
|