【发布时间】:2012-09-21 18:19:44
【问题描述】:
我有一个 ExtJs 组合框。它的商店使用 JSON 加载(使用我的商店)。我想将所有值加载到存储中,然后使用组合文本字段中输入的文本过滤它们。
我不希望我的组合每次输入内容时都重新加载其存储。我怎样才能做到这一点? 还有其他事情,然后我第一次尝试从组合框中选择元素,它从服务器重新加载数据。 PS:我商店中的侦听器,用于从服务器中选择数据的第一个元素。 谢谢。
这是我的商店类:
Ext.define('KP.store.account.street', {
extend: 'Ext.data.Store',
model: 'KP.model.account.combo',
autoLoad: true,
proxy: {
type: 'ajax',
api: {
read: '/account/combostreetdata'
},
reader: {
type: 'json',
root: 'combolist',
successProperty: 'success',
totalProperty: 'total'
}
},
listeners: {
'load': function (street_list) {
var street_combo = Ext.getCmp('street');
street_combo.select(street_list.getAt(0));
}
}
});
我的看法:
{
id: 'street',
xtype: 'combobox',
width: 700,
name: 'street',
editable: true,
mode: 'local',
typeAhead: true,
emptyText: '?????',
fieldLabel: '???',
labelWidth: 120,
size: 72,
x: 20,
y: 180,
displayField: 'string_value',
valueField: 'long_key',
store: street_list
},
【问题讨论】:
标签: javascript extjs4