商店在单独的函数中使用 bindStore 绑定到组合框。
一切正常 - 除了我需要根据给定参数过滤该函数中的数据。
loadMarkers: function(store, value){
store.filter('markerid',17);
this.fields.marker.bindStore(store);
this.fields.marker.setValue(value);
}
这个具体的例子有两种不同的方式,我试过了——绑定之前和之后。最后的 Console.log 显示了“存储”甚至组合框的过滤存储。但是组合框本身仍然显示了一切。
组合框配置:
marker: new Ext.form.ComboBox({
fieldLabel: _('Marker'),
displayField: 'name',
valueField: 'id',
mode:'local',
lastQuery: '',
store: new Ext.data.JsonStore({
fields: ['name', 'id', 'markerid'],
data: [
{name:_('Default'), id: 0, markerid: 0}
]
})
})
this.markerStore = new Ext.data.JsonStore({
autoLoad: true,
url: 'Api/getMarkers',
root: 'response',
sortInfo: {field: 'name', direction: 'ASC'},
fields: Ext.data.Record.create([
{name: 'id', type: 'integer'},
{name: 'name', type: 'string'},
{name: 'markerid', type: 'integer'}
])
});