我正在尝试使用数据存储(而不是硬编码列表)实现Ext.ux.grid.filter.ListFilter,如ExtJS 4 API中所述 - Ext.ux.grid.filter.ListFilterView source...。我在这个列标题上看到了一个过滤器选项,但现在我想知道如何从商店加载选项?我尝试使用下面的代码,但它不起作用。 如果选项是硬编码的,则过滤器可以正常工作。
这里有一些代码:
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
},
]