aslagle / reactive-table

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

checkbox states is lost during navigation #475

Open sanmisasi opened 6 years ago

sanmisasi commented 6 years ago

I have more than 100 records displayed in the reactive table each page having 5 rows, one of the column is a dynamic checkbox and the header label is also a checkbox which is select all checkbox. My issue is when I select first page checkbox and navigate to other page , the checkbox states in the first page is lost . How to keep the checkbox states when navigating to other pages and also select all does not select all the checkboxes it only selects the current page checkbox. What is the solution for retaining checkbox states during navigation?

thank you

aslagle commented 6 years ago

The table won't do anything automatically, but you can store the checkbox states somewhere and update the state when a box is checked or unchecked, and use the states when rendering the checkboxes. You could keep the checkbox states in a collection or in separate ReactiveVars that you look up for each item.

sanmisasi commented 6 years ago

Can you give me a example how to store the checkbox states and render the checkbox states when navigating pages.

aslagle commented 6 years ago

Sorry, I don't have an example of that. You can see this example of how to create a ReactiveVar. Instead of creating one ReactiveVar like that example though, you'd need one for each row in your table, and you'd need to look it up in each row's template or function. It might be easier to use a Collection but I don't have an example of that either.