if (typeof (InitData) == 'undefined' || InitData == null) { InitData = {}; }
InitData.Terminal = {
terminalNos: [{id:'', name:'全部'}] //下拉框终端号
}
// 从后台取值
InitData.init = function () {
// 初始数据的取得
Com.Ajax.createAjaxRequest({
url: 'Data/GetTerminalData',
succFn: function (obj) {
for (var i = 0, max = obj.data.items.length; i < max; i++) {
var ter = obj.data.items[i];
InitData.Terminal.terminalNos.push({ id: ter.id, name: ter.name });
}
}
});
}
// 数据源
var t_store = Ext.create('Ext.data.Store', {
fields: ['id', 'name'],
data: InitData.Terminal.terminalNos,
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});
var tercombo = Ext.create('Ext.form.ComboBox', {// 条件:终端编号
fieldLabel: '终端编号',
id: id_combo_terminal,
name: 'slipInfo.Terminal',
labelWidth: 80,
width: 278,
value: '', // 设置默认选中值
store: t_store,
editable: false, // 设置为只可选择,不可编辑
queryMode: 'local', // 本地数据时使用'local'
//triggerAction: 'all',
valueField: 'id',
isplayField: 'name'
});
c# 后台
List list = new List();
Hashtable rtnVal = new Hashtable();
List terlist = Common.TerminalNo.TERMINAL_LIST;
if(terlist != null)
{
for(int i=0; i {
Hashtable ht = new Hashtable();
ht["id"] = terlist[i];
ht["name"] = terlist[i];
list.Add(ht);
}
}
rtnVal["totalcount"] = terlist.Count();
rtnVal["items"] = list;
return CreateJsonResult(true, data: rtnVal);