Hi,
I'm a using DataTables to show the results of a query with some filters. I'm using Zend Framework with Zend Form to obtain data for making the Postgresql query.
DataTables: 1.8.2
Jquery: v1.7.1
Jquery ui: 1.8.12
As some queries overloads php memory (almost 100.000 rows), i decided to use the ajax request to only ask for certain pages of each request.
The point is:
I checked for the json response and it's always well formed, and json lint says it's valid, but it is not shown in the dataTable, for example a query asking for rows with date=2013/01/15 which has exactly 16 rows.
But if I make a query asking for the same date and type='extra' which returns exactly the same 16 rows, and the json returned is exactly the same, it is drawn, shown or whatever you want to call it.
I debugged the queries to db, the code and every param from the server (it is an internal aplication so it can't be shown directly), and tried almost every option. And I don't know what to do to make it go well.
Here some parts of the code:
Parameters passed to the jQuery
And the formation of the response.
And the json gotten from the server with it (passed through json lint to make it readeble):
Any ideas that can make it go well would be welcomed. I've been working on this for more than a week and I'm a bit frustrated that sometimes it works and sometimes not.
Thanks in advance.
I'm a using DataTables to show the results of a query with some filters. I'm using Zend Framework with Zend Form to obtain data for making the Postgresql query.
DataTables: 1.8.2
Jquery: v1.7.1
Jquery ui: 1.8.12
As some queries overloads php memory (almost 100.000 rows), i decided to use the ajax request to only ask for certain pages of each request.
The point is:
I checked for the json response and it's always well formed, and json lint says it's valid, but it is not shown in the dataTable, for example a query asking for rows with date=2013/01/15 which has exactly 16 rows.
But if I make a query asking for the same date and type='extra' which returns exactly the same 16 rows, and the json returned is exactly the same, it is drawn, shown or whatever you want to call it.
I debugged the queries to db, the code and every param from the server (it is an internal aplication so it can't be shown directly), and tried almost every option. And I don't know what to do to make it go well.
Here some parts of the code:
Parameters passed to the jQuery
list($module, $controller, $action) = explode("/", getenv('REQUEST_URI')); /*Agafem el nom del controller, action, module i primer parametre*/ $rest = explode("$module/$controller/$action/", getenv('REQUEST_URI')); if(($action == 'search' || $action == 'ajax') && $comprovacio['ajax_pagination']){ $sUrl = $module."/".$controller."/"."ajax".$rest[1]; $aParams = array("bJQueryUI" =>true, "bPaginate" => true, "bInfo" => true, "bAutoWidth" => false, "bFilter" => false, "bSort" => false, "bServerSide" => true, "bDestroy" => true, "sServerMethod" => "POST", "sPaginationType"=> "full_numbers", "sAjaxSource"=> $sUrl ); }Using a simple transformation in the jQuery, of course.
And the formation of the response.
$response = array( "iTotalRecords" => $iEntitySet, "iTotalDisplayRecords" => $iEntitySet, "sEcho" => intval($sEcho), "aaData" => $data/*Aixo es el que mostra la taula*/ ); $this -> _helper -> json($response);
And the json gotten from the server with it (passed through json lint to make it readeble):
{ "iTotalRecords": 888, "iTotalDisplayRecords": 888, "sEcho": 1, "aaData": [ [ "<a title=\"Editar\" href=\"registre/registreentrada/edit/id/11536/hash/n_xR35_d7XH66agrGBSxgHvUovK7JbNzcvO8rjEllu0=\" ><img src=\"../../common/public/imgs/edit.png\"></a>", "2012/0755", "<a class=\"fwLink\" target=\"new\" href=\"common/file/download/name/E2012-0755.pdf/hash/1v7i4z_J0zu4qcWrjdX8rp77wdJVAkxlTRi3s5425gU=\"fwtitle=\"E2012-0755.pdf\"><img align=\"center\" src=\"../../common/public/imgs/ico-pdf.png\"></a>", "2012-11-16", "2012-11-16", "Convenis Empresa (pràctiques)", "Manel Hernández Montuenga, Socio Sagardoy", "Javier Junceda Moreno, Degà FCJP", "Conv. prac. FCJP y SAGARDOY ABOGADOS, S.L.", "campus Barcelona" ], [ "<a title=\"Editar\" href=\"registre/registreentrada/edit/id/11525/hash/011d1CJKca7QIvixsVcK4_vi4tkXcU60qHCek8Z1ns0=\" ><img src=\"../../common/public/imgs/edit.png\"></a>", "2012/0744", "<a class=\"fwLink\" target=\"new\" href=\"common/file/download/name/E2012-0744.pdf/hash/F_l6OdYZaZ6GkrrsSgePfD_h56mGPhN5vn2uCAt0MXM=\"fwtitle=\"E2012-0744.pdf\"><img align=\"center\" src=\"../../common/public/imgs/ico-pdf.png\"></a>", "2012-11-14", "2012-11-14", "Convenis Empresa (pràctiques)", "Núria Mompel i Tusell, Abogada", "Francisco Javier Junceda Moreno", "Conv. prac. FCJP i NÚRIA MOMPEL I TUSELL", "campus Barcelona" ], [ "<a title=\"Editar\" href=\"registre/registreentrada/edit/id/11526/hash/bqX52wu9oefpx9DYu96KLEkHFBorHON2uGAHnVa2Tz8=\" ><img src=\"../../common/public/imgs/edit.png\"></a>", "2012/0745", "<a class=\"fwLink\" target=\"new\" href=\"common/file/download/name/E2012-0745.pdf/hash/Qs_4XFq1wmp9398ynjpr4E14uBLLI1IODdb1OKgDlpc=\"fwtitle=\"E2012-0745.pdf\"><img align=\"center\" src=\"../../common/public/imgs/ico-pdf.png\"></a>", "2012-11-14", "2012-11-14", "Convenis Empresa (pràctiques)", "Marti Gisbert Marti, Gerent", "Francisco Javier Junceda Moreno", "Conv. prac. FMCS i Centre de Fisioteràpia Marti Gisbert i Marti", "campus Barcelona" ], [ "<a title=\"Editar\" href=\"registre/registreentrada/edit/id/11509/hash/_esKWtNvAoN8Kf4h1lh3Jl0SPe_3X6lIULXxCODkCSU=\" ><img src=\"../../common/public/imgs/edit.png\"></a>", "2012/0728", "<a class=\"fwLink\" target=\"new\" href=\"common/file/download/name/E2012-0728.pdf/hash/FJBJwSs7K4V2_x1aRy9ycwYUplGtFjTRjYOSjDfRSUc=\"fwtitle=\"E2012-0728.pdf\"><img align=\"center\" src=\"../../common/public/imgs/ico-pdf.png\"></a>", "2012-11-08", "2012-11-08", "Convenis Empresa (pràctiques)", "Victor Latorre Val, Administrador", "Vicenç Sarrablo, Director ESARQ", "Conv. prac. ESARQ i Canales del Fluviá Náutic, S.L.", "campus Barcelona" ], [...],//filled as the ones before, to save some space here [...], [...], [...], [...], [...] ] }
Any ideas that can make it go well would be welcomed. I've been working on this for more than a week and I'm a bit frustrated that sometimes it works and sometimes not.
Thanks in advance.