I’m working with the latest codeIgniter released, and i’m also working with jquery datatables from datatables.net
I’ve written this function: https://gist.github.com/4478424 which, as is works fine. Except when I filter by using the text box typing something in. The filter itself happens, but my count is completely off.
I tried to add in $res = $this->db->count_all_results() before my get, and it stops the get from working at all. What I need to accomplish, if ($data['sSearch'] != '') then to utilize the entire query without the limit to see how many total rows with the search filter exists.
If you need to see any other code other than whats in my gist, just ask and I will go ahead and post it.
$this->db->count_all_results()replaces$this->db->get()in a database call.I.E. you can call either
count_all_results()orget(), but not both.You need to do two seperate active record calls. One to assign the results #, and one to get the actual results.
Something like this for the count:
And for the actual query (which you should already have):