Extjs 在Sencha Touch应用程序中使用exactMatch过滤Ext.data.Store
我正在尝试使用exactMatch筛选项目列表,以便获得具有确切ID的项目: 此代码工作正常,但它返回ID以必需项开头的所有项:Extjs 在Sencha Touch应用程序中使用exactMatch过滤Ext.data.Store,extjs,sencha-touch,sencha-touch-2,Extjs,Sencha Touch,Sencha Touch 2,我正在尝试使用exactMatch筛选项目列表,以便获得具有确切ID的项目: 此代码工作正常,但它返回ID以必需项开头的所有项: itemslist.getStore().filter('type_id',this.getType().getValue()); 如果类型ID的值为1,则返回该类型ID为1XXX的所有元素。但我只想要类型正好为1的元素 我找到了一个解决方案,因此我更改了代码以使用exactMatch,但它不起作用,这是我的代码: itemslist.getStore().filt
itemslist.getStore().filter('type_id',this.getType().getValue());
如果类型ID的值为1,则返回该类型ID为1XXX的所有元素。但我只想要类型正好为1的元素
我找到了一个解决方案,因此我更改了代码以使用exactMatch,但它不起作用,这是我的代码:
itemslist.getStore().filter({
property: 'type_id',
value: this.getType().getValue(),
exactMatch: true
});
即使我删除了exactMatch行,它也不起作用,结果是空的。你能告诉我这两种方法的区别以及如何让exactMatch工作吗?谢谢试试这个:
itemslist.getStore().filter(Ext.create('Ext.util.Filter', {
property: "type_id",
value: this.getType().getValue(),
exactMatch: true
}));
不确定这是否会进行更改,但有时…尝试以下操作:
itemslist.getStore().filter(Ext.create('Ext.util.filter',{property:'type_id',value:this.getType().getValue(),exactMatch:true})代码>不确定这是否会改变,但有时…它工作得非常完美!谢谢!