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

FR: warning when clear selection due to filter/sort #163

Open ashi009 opened 7 years ago

ashi009 commented 7 years ago

As an side effect, filter and sort will clear selection, which might be unintended (especially for sorting)

Hence, I think it should either preserving the selection (might be hard to implement) or at least showing a warning message before clearing the selection.

Saulis commented 7 years ago

Hi!

This is actually by design – the challenge is that we're comparing the item objects to determine if they're selected or not and the assumption is that when filtering/sorting happens, data is fetched again from the remote data source and items get replaced by new objects.

Now, this isn't of course true when using an array data source, but I've used this approach there also for coherence.

I'm considering exposing attr-for-selected or similar to configure which subproperty would be used for determining the selection, which would allow a behavior where the selection gets never cleared. How would it sound?