KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Datatables paging not working. #1952

Closed Jeremy Gray opened this topic on on Mar 8, 2021 - 1 comments

Jeremy Gray commented on Mar 8, 2021

Results of pagination are broken.

  • The "NEXT" button for pagination is not functional at all.
  • Only first and last page show accurate results. (only page 1 and page 7 accurate) --- page 1 results: "Showing 1 to 0,100 of 646 entries" --- page 7 results: "Showing 601 to 646 of 646 entries"
  • All middle pages show like "Showing 301 to 646 of 646 entries" (it shows all 646 entries on page 2,3,4,5,6)

Using code:


    <?php
    DataTables::create(array(
        "dataSource"=>$this->dataStore("result"),
        "plugins" => ["Buttons"],
        "options" => array(

        "paging"=>true,
        "pageLength"=>'100',
        "searching"=>true,

        "columnDefs"=>array(
                array(
                "targets"=>array(2),
                "visible"=>true,
                "type"=>'date',
                ),
                array(
                "targets"=>array(7),
                "visible"=>true,
                "type"=>'num',
                ),


        ),


            "dom" => 'Bfrtip',
            "buttons" => [
                        'copy', 'csv', 'excel',

  array(
            'extend'=>'pdfHtml5',
            'orientation'=>'landscape',
            'pageSize'=>'LEGAL',
            'text'=>'PDF'
        ),

'print',
            ],

        ),
        "cssClass"=>array(
            "table"=>"table table-striped table-bordered"
        ),

        "searchOnEnter" => true,
        "searchMode" => "or"
    ));
    ?>

Jeremy Gray commented on Mar 8, 2021

I added:


  "pageLength" => 50,
        "lengthMenu" => [50, 100, 500, "All"],

now seems to be working as expected

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

DataGrid