aslagle / reactive-table

A reactive table designed for Meteor
https://atmospherejs.com/aslagle/reactive-table
Other
328 stars 138 forks source link

Detecting a (user clicked) column sort event #463

Closed cormip closed 7 years ago

cormip commented 7 years ago

I'm working on saving state and have the currentPage, RowsPerPage and my custom filter working nicely.

However, all that gets "broken" if there's more than a page-full of rows that have been sorted by the user.

The rows the user sees when returning depends on knowing the column sorted and its order. However, I don't see how to simply capture the sort event so that I can save the column clicked and its sort order to a session variable.

Any thoughts on how to do this that doesn't get too "kludgy"?

aslagle commented 7 years ago

Within a column, you can set sortOrder and sortDirection to be ReactiveVars and you can listen for changes to them the same way you would for currentPage. It's kludgier because you have to do it for every column, but I think that's the best way to do it.

cormip commented 7 years ago

OK, that's the way I'll do it then. Thanks.