0

I have created a server side pagination datatable, but when created it shows only the limited records(10 records) on the first load of datatable. After the initial load there is only one button shown as 1. there is no previous or next button and there is no buttons like 2,3,4,etc. My client side code is:

var dataTable = $('#inner_table').DataTable({
        'processing': true,
        'serverSide': true,
        'serverMethod': 'get',
        'paging' :true,
        'pagingType':"simple_numbers",
        'lengthChange': false,
        'searching': false,
        'ajax': {
            'url': '{{ route("inner_search") }}',
            'data': function(data) {
                // // Append to data
                data.searchBycode = $('#searchBycodes').val();
                data.searchBydescription = $('#searchBydescription').val();
            }
        },
        'columns': [{
                data: 'formatted_dx_code'
            },
            {
                data: 'short_desc'
            }
        ],
        "fnDrawCallback": function(oSettings) {
                console.log(oSettings);
                
             if ($(this).find('tbody tr').length <= 15) {
                 
             }
        },

});

The screenshot of the datatable is not showing other pagination butto in my page is :

Bottom of the datatable created

Am I missing anything?

  • are you missing the cdn? – STA Mar 20 '21 at 09:22
  • I have added in the page. Actually Datatable is loaded and searching is also working but the pagination is not working. Any other thing to correct – Bannarisamy Shanmugam Mar 20 '21 at 09:24
  • "Showing 1 to 10 of 10 entries". I guess there are no more records to show in the next pages. – iamab.in Mar 20 '21 at 09:26
  • There are almost 19000 records. I checked in database. but couldn't load in view. the start value in the datatable needs to be changed to 1 or 2 while clicking on pagination. the pagination button since not visible the start value is not changed. i hope it is the issue. – Bannarisamy Shanmugam Mar 20 '21 at 09:27
  • The server needs to tell DataTables how many records there are overall, and how many filtered records. See `recordsTotal` and `recordsFiltered` in the [server-side documentation](https://datatables.net/manual/server-side#Returned-data). Is your server providing this data to DataTables in its responses? – andrewJames Mar 20 '21 at 12:52
  • Yes, the recordsTotal and recordsFiltered are sent from server. – Bannarisamy Shanmugam Mar 22 '21 at 05:12

0 Answers0