kishanov / re-frame-datatable

DataTable component for re-frame library
https://kishanov.github.io/re-frame-datatable/
Eclipse Public License 1.0
103 stars 16 forks source link

[feature] allow filters per column #3

Open smee opened 7 years ago

smee commented 7 years ago

This pull request is not production ready, but rather an invitation for discussion.

I needed a way to introduce filterable columns. I started working on four types of filters:

We still need a way to allow users to add new filter types (dates, timestamps, durations,...) as well as a way to completely replace the filter components (just like pagination).

There is also a distinct lack of documentation/demo code, will be added upon further refinement of the main ideas.

What do you think?

kishanov commented 7 years ago

Thanks for the pull request.

In my original implementation of DataTable I used to have search embedded into DataTable itself (it used to build an index based on data provided during initialization). What I didn't like about it is that if underlying data is changed somehow (new dataset is arriving from server) DataTable has to rebuild index, reapply filters, etc.

My current idea is that filter capabilities should be separated from table view capabilites. "Search" component should be able to index it on it's own and expose a subscription with applied search that DataTable can use as a seed subscription. In this case "Search" component can be used with other collection representation components (lists, trees, etc.)

Let me work on the example of standalone search that "feeds" datatable data. I'll likely have time to work on it during the upcoming weekend

smee commented 7 years ago

Sure, thanks.

ChrisHacker commented 7 years ago

@kishanov Thanks for implementing this. Following up on your last comment here - have you been able to spend any time putting that search example together?

kishanov commented 7 years ago

@ChrisHacker yes, I have a working solution, but it is used in our private codebase and cannot be extracted easily (it has some of our product-specific logic in it). I don't have an estimate when I'll have time to work on generic example :(