Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

searching from multiple inputs as filters on nested JSON [Question] #49

Open
Jamanya opened this issue Oct 2, 2019 · 1 comment
Open

Comments

@Jamanya
Copy link

Jamanya commented Oct 2, 2019

#how would i implement this if i needed to have multiple inputs (6 of them) as search filters that needed to be inclusive , ie.. if i search for a name, AND state, AND topic, it would return the results that match all the filters.

multiple filters seem to work if the json object is FLAT. and from one search box, my use case is having multiple input boxes and a heavily nested object.

@aVolpe
Copy link
Collaborator

aVolpe commented Apr 17, 2020

I think this is a complex case that is out of scope of this library, however, you can use the code to create a custom filter.

A trick that I use when i encoutner this kind of problem is to add a new field en the object "searchField" that is the concatenation of the search fields, for eaxmple:

    const data = [...].map(d => ({ ...d, searchField: `${d.name}-${d.state}-${d.parent.children}` });

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants