javve / list.pagination.js

A pagination plugin for List.js
24 stars 23 forks source link

Changing the number of pages #15

Open J35P1N opened 9 years ago

J35P1N commented 9 years ago

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.

nespapu commented 8 years ago

Same problem here. Did you find a solution? I need to refresh the page so the new configuration takes effect.

seb-vial commented 8 years ago

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(); }