Closed group22dsl closed 7 years ago
If you're using Blaze template, then you can do it like this:
Template.myList.onCreated(function () {
this.pagination = new Meteor.Pagination(Customer, {
sort: {
name: 1 // set initial sort
}
});
this.autorun(() => {
// change sorting every time the session value for sortNumber changes
this.pagination.sort({ name: Session.get("sortNumber") });
});
});
this.pagination = new Meteor.Pagination(Customers, { sort: { name: 1 } });
Original code is like above. But I think this subscription is not reactive. I want to change this sorting like following.this.pagination = new Meteor.Pagination(Customers, { sort: { name: Session.get("sortNumber") } });
But it not works with Session. Please help me to solve this. Thanks