How can I specify the number of rows to display on a single "page" when using DataTables's pagination feature?
标签:
datatables
相关问题
- jQuery DataTable - Search a column of dropdowns
- Uncaught TypeError: undefined is not a function fo
- Avoid Rendering “No Data Available in the table” i
- datatables initialize table after button click (aj
- Jquery datatable Sort not working for Date Column?
相关文章
- DataTable : How to hide table header?
- Selecting all visible rows after a search using
- How to add a class to a new row in a jquery datata
- jQuery Datatables - how to programatically sort by
- Loading DataTable using ajax
- Data Tables Get iDataRow in mRender
- DataTables warning: table id=dataTables - Ajax err
- How to search for an exact string in a jQuery Data
using version 1.11 - use the attribute 'data-show'.
for 10 records
for 50 records
for all records
For DataTables version 1.10.5 and newer, as documented on the blog post announcing the integration of HTML5 data-* attributes, the number of rows to show per page can be specified via the source (HTML) table through the
data-page-length
attribute:For DataTables version 1.10 and newer, as documented at Reference > Options > pageLength, the number of rows to show per page can be specified via the
pageLength
attribute:For DataTables older than version 1.10, as documented at DataTables > Usage > Options > iDisplayLength, the number of rows to show per page can be specified via the
iDisplayLength
attribute:My two cents: use the
data-*
approach. It allows you to construct one dataTable call (that you can use throughout your app) while providing the option to configure how each individual table behaves:We can set attribute using jquery and add up in a common file.
This will apply for all the datatables across the project
Using lengthMenu may help too:
} );
https://datatables.net/examples/advanced_init/length_menu.html