Probleme dataTable 1.7.4 to 1.8

Probleme dataTable 1.7.4 to 1.8

xciDxciD Posts: 3Questions: 0Answers: 0
edited January 2012 in Bug reports
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 !!!!

Replies

  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    Can you link us to the page please? From the information provided it looks like it should be okay.

    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
  • xciDxciD Posts: 3Questions: 0Answers: 0
    The problems is that the webwite is'nt now online.

    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
  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    > { "sName" : "category_id", "bSearchable": true },],

    You've got a trailing comma - that isn't going to help.

    Allan
  • xciDxciD Posts: 3Questions: 0Answers: 0
    the trailing comma doesn't change anything :/
    what is the json type ?
    Thanks
  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    Everything else looks like it should be okay. I'm afraid I think I would need to be able to see the application to be able to debug it further as it is not clear where it is going wrong.

    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
  • sanuslsanusl Posts: 1Questions: 0Answers: 0
    @xciD : If you don't mind, can you please share the CakePHP code you have used to implement the datatable with CakePhp.

    I am trying hard to get an example and a working copy of integrated jqGrid datatable with CakePHP with Ajax.

    Please help me.
This discussion has been closed.