Extjs4.2关于combobox通过direct绑定服务器数据
有朋友通过Ext.data.DirectStore给combobx绑定过数据么
代码如下
xtype: 'combobox',
id: 'ctlEMS_NO',
editable: true,
queryMode: 'local',
typeAhead: true,
selectOnFocus: true,
store: Ext.create('Ext.data.Store', {
model: 'dropModel',
proxy: {
type: 'direct',
directFn: app.Method.Code,
reader: {
type: 'json',
root: 'data'
},
},
autoLoad: true
}),
displayField: 'Text',
valueField: 'Value',
fieldLabel: '编码',
triggerAction: 'all',
emptyText: '请选择'
}
这样绑定的话虽然后台返回了数据,但是绑定不到combobox上,但是用下面一种却没问题
xtype: 'combobox',
id: 'ctlEMS_NO',
editable: true,
queryMode: 'local',
typeAhead: true,
selectOnFocus: true,
store: Ext.create('Ext.data.Store', {
model: 'dropModel',
proxy: {
type: 'ajax',
url: '../modulehelp.ashx?action=Code',
reader: {
type: 'json',
root: 'data'
},
},
autoLoad: true
}),
displayField: 'Text',
valueField: 'Value',
fieldLabel: '编码',
triggerAction: 'all',
emptyText: '请选择'
}
有用过的朋友给我点提示呢,谢谢啦
[解决办法]
4.1+需要配置directCfg的method的getArgs,和4.0-不一样
Ext4 Ext.data.proxy.Direct directFn示例