Probleme dataTable 1.7.4 to 1.8
Probleme dataTable 1.7.4 to 1.8
xciD
Posts: 3Questions: 0Answers: 0
Hello, I'm trying to integrate dataTable on cakephp 2.0.
I've almost success but I'm blocking on a probleme now.
My Server-side processing is well working on dataTable 1.7.4 but I want to upgrade the plugin to 1.8.0 and a problem appear :
[quote]DataTables warning (table id = 'datatable'): Requested unknown parameter '0' from the data source for row 0[/quote]
There is my JSON return :
{"aoColumns":"date,name,typeoperation_id,montant,category_id",
"sEcho":1,
"iTotalRecords":103,
"iTotalDisplayRecords":103,
"aaData":[
["2011-01-08","Nullam",null,"-14","T\u00e9l\u00e9phone"],
["2011-01-10","lacus.","CB","-178","Frais Bancaires"],
["2011-01-14","neque","CB","449","Epargne"],
["2011-01-19","sociis",null,"393","Vacances"],
["2011-01-21","ipsum","CB","573","Vacances"],
["2011-01-24","vestibulum,",null,"352","Salaires"],
["2011-01-27","Cum",null,"-93","T\u00e9l\u00e9phone"]
...
]}
Thanks for your help !!!!
I've almost success but I'm blocking on a probleme now.
My Server-side processing is well working on dataTable 1.7.4 but I want to upgrade the plugin to 1.8.0 and a problem appear :
[quote]DataTables warning (table id = 'datatable'): Requested unknown parameter '0' from the data source for row 0[/quote]
There is my JSON return :
{"aoColumns":"date,name,typeoperation_id,montant,category_id",
"sEcho":1,
"iTotalRecords":103,
"iTotalDisplayRecords":103,
"aaData":[
["2011-01-08","Nullam",null,"-14","T\u00e9l\u00e9phone"],
["2011-01-10","lacus.","CB","-178","Frais Bancaires"],
["2011-01-14","neque","CB","449","Epargne"],
["2011-01-19","sociis",null,"393","Vacances"],
["2011-01-21","ipsum","CB","573","Vacances"],
["2011-01-24","vestibulum,",null,"352","Salaires"],
["2011-01-27","Cum",null,"-93","T\u00e9l\u00e9phone"]
...
]}
Thanks for your help !!!!
This discussion has been closed.
Replies
Note that the returned parameter "aoColumns" is not a known parameter. Do you actually mean "sColumns"? DataTables 1.8 provides a much better way to do that kind of thing: http://datatables.net/blog/Extended_data_source_options_with_DataTables
Allan
There is my call js :
[code]
$("#datatable").dataTable( {
"sPaginationType": "full_numbers",
"sScrollY": "500px",
"bScrollInfinite": false,
"bProcessing": false,
"bLengthChange": true,
"bScrollCollapse": false,
"iDisplayLength": 50,
"bServerSide": true,
"bJQueryUI": true,
"aaSorting": [[0,"asc"]],
"aoColumns": [
{ "sName" : "date", "bSortable": true, "bSearchable": true },
{ "sName" : "name", "bSearchable": true },
{ "sName" : "typeoperation_id", "bSearchable": true },
{ "sName" : "montant", "bSearchable": true },
{ "sName" : "category_id", "bSearchable": true },],
"sAjaxSource": "/membre/comptes/operations/liste/1",
"oLanguage": {
"sProcessing": "Traitement en cours...",
"sLengthMenu": "Afficher _MENU_ Opérations",
"sZeroRecords": "Aucune Opérations à afficher",
"sInfo": "Affichage de l'élement _START_ à _END_ sur _TOTAL_ éléments",
"sInfoEmpty": "Affichage de l'élement 0 à 0 sur 0 éléments",
"sInfoFiltered": "(filtré de _MAX_ éléments au total)",
"sInfoPostFix": "",
"sSearch": "Rechercher :",
"sUrl": "",
"oPaginate": {
"sFirst": "Premier",
"sPrevious": "Précédent",
"sNext": "Suivant",
"sLast": "Dernier" }
}
}
);
[/code]
What can I do ?
Thanks
You've got a trailing comma - that isn't going to help.
Allan
what is the json type ?
Thanks
There is one thing I would say, the sName method of ordering columns is now out of date (it should still work just fine in 1.8 and 1.9, but it won't in 1.10 an onwards). It is now recommended to use mDataProp and return objects rather than arrays: http://datatables.net/blog/Extended_data_source_options_with_DataTables
Allan
I am trying hard to get an example and a working copy of integrated jqGrid datatable with CakePHP with Ajax.
Please help me.