我正在尝试使用 ExtJS 4 API - Ext.ux.grid.filter.ListFilterView 源...中介绍的数据存储(而不是硬编码列表)来实现 Ext.ux.grid.filter.ListFilter 。我在此列标题上看到了一个过滤器选项,但现在我想知道如何从商店加载选项?我用下面的代码尝试了它,但它不起作用。如果选项是硬编码的,则过滤器可以正常工作。
这是一些代码:
var tradeStore = new Ext.data.JsonStore({
fields: ['tradegroup_id','tradegroup_name'],
data: [
{ tradegroup_id: 1, tradegroup_name: '10 T-shirts' },
{ tradegroup_id: 2, tradegroup_name: '15 polo' },
{ tradegroup_id: 3, tradegroup_name: '60 Pants' },
{ tradegroup_id: 4, tradegroup_name: '62 Denim' }
],
autoLoad: {
// this callback function is actually Ext js 4, how to convert it to Ext js 3?
callback: function() {
grid.getView().getHeaderCt().child('#Trademark').initialConfig.filter.options = tradeStore.collect('tradegroup_name');
}
}
});
_filtersPlugin = new Ext.ux.grid.GridFilters({
encode: encode, // json encode the filter query
local: local, // defaults to false (remote filtering)
filters: [
{
type: 'list',
dataIndex: 'Trademark',
options: []
// options: ['10 T-shirts', '60 Pants'] // this is harcoded, I don't want this
store: tradeStore
},
]