Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced Filtering #746

Closed
benoj opened this issue Oct 4, 2017 · 3 comments · Fixed by #807
Closed

Advanced Filtering #746

benoj opened this issue Oct 4, 2017 · 3 comments · Fixed by #807
Assignees

Comments

@benoj
Copy link

benoj commented Oct 4, 2017

Hey,

Like the project, jut wondering if it is possible to do more advanced filtering across multiple fields e.g. say with row data
{ name: "Bob", age: 20, categories: ["male","young"] }, { name: "Alice", age: 49: categories: ["female", "middle-age"]

Would it be possible to search by:

a) age between x and y
b) which categories a person is in
c) text search on name

From docs it looks like its just text across all of the properties? Are the more advanced searches that I am talking about possible?

Thanks,

Ben

@dahlbyk
Copy link
Contributor

dahlbyk commented Oct 4, 2017

Nothing about the component implementation requires that filter be limited to a simple string, but that's how Filter and LocalPlugin are currently implemented.

Customizing the former to setFilter with a complex filter object should be relatively straightforward. Customizing the latter is currently pretty tedious, short of cloning LocalPlugin, but #743 should improve that situation. It also seems reasonable that we could update LocalPlugin to be a lot smarter about filtering out of the box, e.g.:

setFilter({
  age: a => (x <= a && a <= y),
  categories: [cat1, cat2],
  name: nameSubstring
})

In other words, if filter is an object we would treat its keys as the column ids to be filtered, with either string values, an array of values to match, or a predicate to apply to the value. Would be glad to help if anyone's interested in taking a crack at this.

@benoj
Copy link
Author

benoj commented Oct 4, 2017

I need this functionality for what I'm doing so will make a PR against this hopefully in the next few days.

Cheers,

Ben

@aaronsmulktis
Copy link

This was exactly what I needed as well. Thank you @benoj for hooking this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants