list.pagination.js
list.pagination.js copied to clipboard
Changing the number of pages
Hi,
I am trying to allow my end user to select the number of results shown per page. How would I do this?
At the moment I have this code:
var numberOfItems = 3; var options = { valueNames: ['name', 'type', 'difficulty'], page: numberOfItems, plugins: [ ListPagination({}) ] }; var userList = new List('search', options);
$('.changePages').on("click",function(){ numberOfItems = 2; userList.update(); }
This should update the pagination as far as I am aware but nothing happens when I click my button with the changePages class.
Same problem here. Did you find a solution? I need to refresh the page so the new configuration takes effect.
Try this:
var numberOfItems = 3; var options = { valueNames: ['name', 'type', 'difficulty'], page: numberOfItems, plugins: [ ListPagination({}) ] }; var userList = new List('search', options);
$('.changePages').on("click",function(){ userList.page = 2; userList.update(); }