rayman1104 / ra-data-nestjsx-crud

Data provider which integrates React Admin with NestJS CRUD library
MIT License
100 stars 27 forks source link

How to correctly pass OR in cumulative filters? #50

Open ezalivadnyi opened 9 months ago

ezalivadnyi commented 9 months ago

Hi guys! I want to select more than one category but I'm confused about how to use OR in cumulative filters.

An example from react-admin documentation suggests to use arrays to store it: https://marmelab.com/react-admin/FilterList.html#cumulative-filters

But this array throws an error:

TypeError: flatFilter[key].match is not a function
    at ra-data-nestjsx-crud.ts:47:37

I see $OR: orFilter key in this repository, but the question is how to correctly pass the values to this filter?

https://github.com/nestjsx/crud/wiki/Requests#or

Here is an example of my filter

<FilterList label="Category" icon={<CategoryIcon />}>
    <FilterListItem label="a" value={{ category: 'a' }} isSelected={isSelectedCategory} toggleFilter={toggleFilterCategory} />
    <FilterListItem label="b" value={{ category: 'b' }} isSelected={isSelectedCategory} toggleFilter={toggleFilterCategory} />
    <FilterListItem label="c" value={{ category: 'c' }} isSelected={isSelectedCategory} toggleFilter={toggleFilterCategory} />
</FilterList>

Provide me with some examples, please! Thanks for your help!