aslagle / reactive-table

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

Client-side change page number through custom button #477

Closed maltahs closed 6 years ago

maltahs commented 6 years ago

Hi,

First of all, this is a great library!

I've been trying to create customised client-side buttons to allow for navigation through the pages, but have no idea how to make it work. Is there a specific method I can add to my client-side event listener that can change the page?

I looked at the existing element for "next page", [class="next-page fa fa-caret-right"] but couldn't find the relevant click event to trigger page change. Would be grateful if someone can assist.

Thanks.

aslagle commented 6 years ago

Hi, I think the best way to do this would be to use a ReactiveVar for the current page like in this example. The example uses the ReactiveVar to save the current page to the session, but you can also set the ReactiveVar from your event listener to change the page the table is showing.

maltahs commented 6 years ago

Thanks you for the response! I shall give it a try this week.

maltahs commented 6 years ago

Your suggestion worked like a charm.

I used the ReactiveVar, which then I incremented / decremented via the respective custom button event handlers.

Thank you for pointing me to the right direction.