如何使用存储响应设置组合框的DisplayField和ValueFiled,例如:[1,2,3,4,5]
Ext.create('Ext.form.ComboBox', {
id: 'combo',
width: 400,
fieldLabel: 'distinct value',
emptyText: 'select',
store: '',
displayField: 'name',
valueField: 'id',
renderTo:"viewFilter" ,
triggerAction: 'all',
editable: false,
pageSize:10,
});
商店代码
var store = Ext.create('Ext.data.Store', {
pageSize: 50,
model: 'Model',
remoteSort: true,
proxy: {
type: 'ajax',
url: 'dynamicAjax.exc?action=getDistinctValues',
simpleSortMode: true
}
});
我要在组合框上进行延迟加载,如果你有任何替代解决方案,请开车送我。
答案 0 :(得分:0)
据我所知,商店无法使用开箱即用的[1,2,3,4,5]
响应。
您必须将响应转换为模型中的对象。执行此操作后,您可以将字段名称设置为text
,这样您就不必定义displayField
。
我在这里为你做了一个工作小提琴: