How to select second page as start page using jQuery datatable

I am using jQuery datatable. By default, it shows the first page as the start page. But I want to show the second page as the default page. When I use the YUI data table. I have an option like initialPage . Is it possible in jQuery datatable to select the second page as the start page.

Thanks in advance...

+4
source share
3 answers

There is no option in the options object by default. However, you can call the fnPageChange function on a datatable to set pagenumber.

 var table = $('#data_table').dataTable(); table.fnPageChange(2,true); 

Where 2 is the page number, and the second parameter requests data for redrawing.

https://datatables.net/ref#fnPageChange

+4
source

In version 1.10 of DataTables there is a displayStart option that allows you to set the default page.

Note that the displayStart value is the number of entries based on zero, not on pages. If you have 10 entries per page, displayStart: 10 display page 2

 $('#my-datatable').DataTable( { 'displayStart': 10 } ); 

https://datatables.net/reference/option/displayStart

+11
source

I ran into the same problem and the source used an outdated version of datatable. I could fix this by installing "iDisplayStart".

0
source

Source: https://habr.com/ru/post/1485801/


All Articles