2012-10-04 47 views
0

我试图筛选使用exactMatch为了得到与确切的ID项目的项目清单:过滤Ext.data.Store在煎茶触摸应用程序中使用exactMatch

此代码工作正常,但它返回所有该ID开始所需的一个项目:

itemslist.getStore().filter('type_id',this.getType().getValue()); 

如果类型ID的值是1时,它返回其全部类型具有类似的1XXX ID的元素。但我只想要的元素,其类型是完全相同1.

我找到了解决办法here所以我改为使用exactMatch,但它不工作的代码,这是我的代码:

itemslist.getStore().filter({ 
    property: 'type_id', 
    value: this.getType().getValue(), 
    exactMatch: true 
});

即使我删除了exactMatch行,它也不起作用,结果为空。你能告诉我这两种方式有什么区别,以及如何让exactMatch工作?由于

+2

试试这个:'itemslist.getStore()过滤器(Ext.create('Ext.util。 Filter',{property:“type_id”,value:this.getType()。getValue(),exactMatch:true}));'不确定这是否会做出更改,但有时候... –

+0

完美!非常感谢! – bnabilos

回答

2

试试这个:

itemslist.getStore().filter(Ext.create('Ext.util.Filter', { 
    property: "type_id", 
    value: this.getType().getValue(), 
    exactMatch: true 
})); 

不知道这使得改变,但有时...