Saulis / iron-data-table

iron-data-table is a Web Component for displaying data as a table or grid. Built on top of iron-list using Polymer.
Apache License 2.0
147 stars 66 forks source link

added filter method support #196

Open schrotie opened 7 years ago

schrotie commented 7 years ago

Hi there

I added support for generic filter functions. My use-case:

The user can select multiple criteria from a drop-down in the header. Items are kept if they match any of these criteria (OR). This is just what I needed, though. The implementation in iron-data-table is generic and can be used for any complex filter task like combining filters from several columns or whatever.

I tried to touch as little of the existing code as possible, however, I needed to change the way filters are indexed because filter-functions do not have a filterBy property (it's not required and potentially makes the usage of filter functions more difficult for client programmers if it were) which was used as a key for filters. This may change the behavior where client programmers did unhealthy things like using the same filterBy in multiple columns.

I modeled the feature after the "filter" property of Polymer's dom-repeat.

Ugh, and thanks for that great table, love it :-)


This change is Reviewable