pagination not loading on initial table load

pagination not loading on initial table load

RushdyRushdy Posts: 7Questions: 2Answers: 0

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

  • jr42.gordonjr42.gordon Posts: 305Questions: 2Answers: 49

    Please refine your DataTable config to the following and see if it works.

    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
         }
    ]
    })
    
  • RushdyRushdy Posts: 7Questions: 2Answers: 0

    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

  • jr42.gordonjr42.gordon Posts: 305Questions: 2Answers: 49

    Wait a sec, what is variable dt? Also, check out this working example using updated config http://live.datatables.net/yajixebo/1/

  • RushdyRushdy Posts: 7Questions: 2Answers: 0

    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

  • jr42.gordonjr42.gordon Posts: 305Questions: 2Answers: 49
    edited June 2016 Answer ✓

    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.

  • RushdyRushdy Posts: 7Questions: 2Answers: 0

    thanks Jr42.gordon
    appreciate your help

This discussion has been closed.