aslagle / reactive-table

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

currentPage #408

Closed amou1012 closed 8 years ago

amou1012 commented 8 years ago

I want to go back to the first page when I switch the data and I set currentPage in my tableSettings :

tableSettings(){ return { showNavigation: 'auto', showRowCount: 'true', rowsPerPage: 10, currentPage: 0, fields: [.........] } }

But I always stay at the page where I stayed at last time. Can anyone help me ? Thanks!!!! notification6

aslagle commented 8 years ago

Make currentPage a ReactiveVar and then set it to 0 whenever you want to go to the first page.

// Put the variable somewhere accessible to table settings and the code you want to change it from.
var currentPage = new ReactiveVar();

...

tableSettings(){
return {
...
currentPage: currentPage,
...
}
}

...

// To go to the first page:
currentPage.set(0);
amou1012 commented 8 years ago

It works !! Thanks a lot !!!!