pagination not loading on initial table load
pagination not loading on initial table load
Hi there
This is the first time I am using jquey datatable my datatable config as below
dt.DataTable(
{
scrollY: "450px",
scrollX: true,
scrollCollapse: true,
paging: true,
fixedColumns: true,
fixedHeader:true,
footer: true,
bInfo: true,
pageLength: 10,
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
"columnDefs": [
{
"targets": 'no-sort',
"orderable": false
}
]
});
But the issue i am having is on the datable load first time pagination is not coming up it load all the rows in got (10,000)rows but after I select from the dropdown to 10 it reload the datable with pagination.
How can I force the pagination to come in initial datable load.
Appreciate all your help
This question has an accepted answers - jump to answer
Answers
Please refine your DataTable config to the following and see if it works.
changed the config as suggested to
dt.DataTable(
{
scrollY: "450px",
scrollX: true,
scrollCollapse: true,
fixedHeader: true,
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
"columnDefs": [
{
"targets": 'no-sort',
"orderable": false
}
]
but no luck
Wait a sec, what is variable dt? Also, check out this working example using updated config http://live.datatables.net/yajixebo/1/
var dt = $('.table-bordered');
and in the above working example what is Auto-run JS check box is for when i i check it is look the same as the issue i am having there the full table is loaded without pagination
http://live.datatables.net/yajixebo/3/edit
I checked the "Auto-run js" box so it should run automatically. If it doesn't, when you open the link, click the "Run with JS", close and reopen tab. Script should now run automatically.
thanks Jr42.gordon
appreciate your help