Ext Filter具有特殊值

时间:2015-11-24 08:48:25

标签: extjs filter

我有一个模型A(包括模型B)。例如:

fields: [{
    name: 'code',
    type: 'string'
}]
hasMany: [{
    name: 'modelB',
    model: 'modelB'
}]

模特B:

fields: [{
    name: 'code',
    type: 'string'
}]

我想通过Model B的代码向Store A(使用Model A映射)添加过滤器。例如:

Data: {code: 'A001', modelB: [{code: 'B001'}, {code: 'B002'}]},
      {code: 'A002', modelB: [{code: 'B001'}, {code: 'B003'}]},
      {code: 'A003', modelB: [{code: 'B002'}]}
Query value: 'B002'
Expected result: 'A001' and 'A003'

我试过了:

customFilter = Ext.create('Ext.util.Filter', {
    property: 'modelB.code',
    operation: '=',
    value: '001' // <- Model B's code
});

storeA.addFilter(customFilter);

它不起作用。请帮忙!

0 个答案:

没有答案