0

how to get perPage value in below jQuery code from input field whose value is a number as i have to create pagination for table who can control number of rows per page.

$(document).ready(function(){ $('#myTable').pageMe({pagerSelector:'#myPager',perPage:4}); }); 

Input field

<select input type="number" id="numberinput" /> <Option value="10">10</option> <Option value="20">20</option> </select> 

1 Answer 1

3

Bind change() event handler to the dropdown and update perPage option.

$('#numberinput').change(function() { $('#myTable').pageMe({ pagerSelector: '#myPager', perPage: this.value }); });
<select input type="number" id="numberinput"> <option value="10">10</option> <option value="20">20</option> </select>

Sign up to request clarification or add additional context in comments.

4 Comments

yes it is working but it keeps on adding number 1 to my paginator please check the plunker for more clarification embed.plnkr.co/brRrQW3msRV5Nv4HHwDi/preview
@chetan , You need to empty the pagination list using pager.html('') ,plnkr.co/edit/XUnpyIYNYzHEZedUMQMB?p=preview
@chetan : check line 316in updated plunker. In your code you are just appending the new new list item, u r not removing the existing list items
pranav thanks for your prompt reply but still it has a bug. shall i remove default value on line number 292. when i click on page number 2 it shows 7 records again.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.