ionic-filter-bar icon indicating copy to clipboard operation
ionic-filter-bar copied to clipboard

Filter on several attributes

Open ghost opened this issue 10 years ago • 2 comments

Hi,

I would like to know if it is possible to filter not only on 1 attribute, but on several like :

       filterProperties: ['title','description']  // This doesn't work

So, if one of the 2 attributes contains what's in the textFilter, then it's kept in the list.

Thank you & kind regards

ghost avatar Jan 09 '16 14:01 ghost

@kyoshiro2708 I am facing the problem ! Any lead ?

uzumakinaruto123 avatar Jan 16 '16 07:01 uzumakinaruto123

@kyoshiro2708 If I'm right, it seems that you misunderstand the usage of filterProperties.

assume the user searches for "fish"

{name: 'fish', description: 'fish', color: 'blue'}

filterProperties: ['name', 'description'] ... The object will be matched and passed to the array in update filterProperties: ['name', 'color'] ... The object will NOT be matched or passed to the array in update

So in your case, when you input 'abc', items will be considered matched only when BOTH of title and description contains 'abc'.

If you want to filter items by more than one attribute, use the comparator instead of filterProperties.

vcyang avatar Jan 18 '16 04:01 vcyang