Need ideas

Need ideas

aalbertiaalberti Posts: 3Questions: 0Answers: 0
edited January 2013 in DataTables 1.8
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
[code]

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
);
}
[/code]
Using a simple transformation in the jQuery, of course.

And the formation of the response.

[code]
$response = array(
"iTotalRecords" => $iEntitySet,
"iTotalDisplayRecords" => $iEntitySet,
"sEcho" => intval($sEcho),
"aaData" => $data/*Aixo es el que mostra la taula*/
);
$this -> _helper -> json($response);
[/code]

And the json gotten from the server with it (passed through json lint to make it readeble):
[code]
{
"iTotalRecords": 888,
"iTotalDisplayRecords": 888,
"sEcho": 1,
"aaData": [
[
"",
"2012/0755",
"",
"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"
],
[
"",
"2012/0744",
"",
"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"
],
[
"",
"2012/0745",
"",
"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"
],
[
"",
"2012/0728",
"",
"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
[...],
[...],
[...],
[...],
[...]
]
}
[/code]

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.

Replies

  • aalbertiaalberti Posts: 3Questions: 0Answers: 0
    Solved, The problem was I used jQuery to alter the text fields and convert them to links.

    No weird jQuery for using dataTables, lesson learned. Hahahaha
This discussion has been closed.