CodeIgniter Forums
Ignited datatables always return only 100 rows.. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Ignited datatables always return only 100 rows.. (/showthread.php?tid=57124)



Ignited datatables always return only 100 rows.. - El Forum - 02-18-2013

[eluser]Tonko[/eluser]
Hi all, I need your help. I have table where is 404 rows and I use ignited datatables library to show them.
I have problem, because the ignited datatables library always return MAX 100rows
But my controller show this: {"sEcho":0,"iTotalRecords":402,"iTotalDisplayRecords":402,"aaData" [and here is only 100 records, not all 404]...

this is my jquery code in view:
Code:
var oTable = $('.mws-datatable-fn').dataTable( {
     "bProcessing": true,
     "aLengthMenu": [[10, 25, 50, 100, 500, 1000, 5000, -1], [10, 25, 50, 100, 500, 1000, 5000, "All"]],
"iDisplayLength": 1000,
     "sAjaxSource": "<?php echo base_url(); ?>companies/datatables",
     "sPaginationType": "full_numbers"
    } );

and my controller:
Code:
$this->load->library('companies/datatables');

        $this->datatables->select('id, name, kind, address_city, address_country, sales_agent');
        $this->datatables->from('companies');
        echo $this->datatables->generate();
... is this bug or how to solve it? Thanks for help


Ignited datatables always return only 100 rows.. - El Forum - 02-18-2013

[eluser]johnpeace[/eluser]
Do you have the profiler turned on and displaying the queries that are being run?

Code:
$this->output->enable_profiler(TRUE);

Use Firebug to check the POST request and make sure that iDisplayLength is being sent with the request (looks like the datatables library isn't finding it).


Ignited datatables always return only 100 rows.. - El Forum - 02-18-2013

[eluser]Tonko[/eluser]
I have figured it out by editing the function get_paging in datatables library:form
Code:
$this->ci->db->limit(($iLength != '' && $iLength != '-1')? $iLength : 100, ($iStart)? $iStart : 0);
to
Code:
$this->ci->db->limit(($iLength != '' && $iLength != '-1')? $iLength : 10000, ($iStart)? $iStart : 0);
I change the number of limit when lengt is not post... But I have no idea why it is not working properly... any idea why it is not posting the ilenght?