jquery - Added data (size undefined) does not match known number of columns (9) -


okay, 1 driving me nuts.

i'm trying create jquery datatable , keep getting error:
datatables warning (table id = 'properties'): added data (size undefined) not match known number of columns (9)

i have table set 9 columns (i.e. 9 <th> blocks in html)

the javascript appears alright (though if verify sure):

$tableproperties = $('#properties').datatable({     sdom: '<"datatables_header"<"datatables_toolbar">rl>t<"datatables_footer"ip>',     olanguage: { slengthmenu: "show _menu_ lines", sinfo: "showing _start_ _end_ of _total_ lines" },     idisplaylength: <%: shusterconnect.configurationsettings.mgtpropertiesperpage %>,     alengthmenu: [[10, 20, 50, -1], [10, 20, 50, "all"]],     bpaginate: true,     spaginationtype: "listbox",     blengthchange: true,     bfilter: false,     binfo: true,     bautowidth: true,     bprocessing: true,     bserverside: true,     sajaxsource: "/property/queryallproperties",     aasorting: [[ 5, "asc" ]], // default sorting column management company     fnserverdata: function (ssource, aodata, fncallback) {         $.post(ssource, aodata, fncallback);     },     fnrowcallback: function (tr, record, idisplayindex, idisplayindexfull) {         $('td:eq(7)', tr).html(renderactiontemplate(record[7], $('td:eq(4)', tr).text()));         $('td:eq(7)', tr).css("white-space", "nowrap");         if ($('td:eq(4)', tr).text() != "yes")             $(tr).css("background-color", "#c0c0c0");         return tr;     },     aocolumns: [         { "mdataprop": "shusterpropertyid" },         { "mdataprop": "shustercustomerid" },         { "mdataprop": "bepropertyid" },         { "mdataprop": "beusername" },         { "mdataprop": "ismanagementcompany" },         { "mdataprop": "managementcompany" },         { "mdataprop": "mappingfiletype" },         { "mdataprop": "action", "bsortable": false},  // action         { "mdataprop": "parentid" } //parent id      ],     }); }); 

and json returning aadata set 9 values each record: {"secho":"1","itotalrecords":147,"itotaldisplayrecords":147,"aadata":[{"shustercustomerid":"1057","shusterpropertyid":"dev","bepropertyid":"4368058011","beusername":"devon oaks","ismanagementcompany":"","managementcompany":"eliza jennings senior care network","mappingfiletype":"default","action":"57","parentid":""},{"shustercustomerid":"1058","shusterpropertyid":"eliza","bepropertyid":"4368056561","beusername":"eliza jennings home","ismanagementcompany":"","managementcompany":"eliza jennings senior care network","mappingfiletype":"default","action":"58","parentid":""}, ... {"shustercustomerid":"1168","shusterpropertyid":"wesc","bepropertyid":"3008297838","beusername":"wesley court methodist retirement community","ismanagementcompany":"","managementcompany":"sears methodist retirement system","mappingfiletype":"pathlinks","action":"243","parentid":"232"}]}

so... heck going on? have missed vital? suggestions appreciated.

p.s. did spend hour searching interwebs (and stackoverflow), unable find point problem...

the json data format should this: {"secho":17,"itotalrecords":35,"itotaldisplayrecords":35,"aadata":[["2012-12-01","1"],["2012-12-27","1"],["2012-12-26","1"],["2012-12-27","1"],["2012-12-19","1"],["2012-12-27","1"],["2012-12-27","1"],["2012-12-27","1"],["2012-12-27","1"],["2012-12-27","1"],["2012-12-27","1"],["2012-12-21","1"],["2012-12-27","1"],["2012-12-25","1"],["2012-12-26","1"],["2012-01-03","1"],["2012-11-23","1"],["2012-12-02","1"],["2012-11-22","1"],["2012-12-24","1"],["2012-11-14","1"],["2012-11-22","1"],["2012-11-23","1"],["2012-11-22","1"],["2012-11-22","1"],["2012-11-26","1"],["2012-12-20","1"],["2012-12-17","1"],["2012-12-21","1"],["2012-12-12","1"]]}

so formate of data, this: $rresult = $this->db->query($squery); $rresult = $rresult->result_array();

foreach ($rresult $arow) {      $row = array();    foreach ( $arow $key => $val ) {        $row[] = $val; }        $output['aadata'][] = $row;     } echo json_encode( $output ); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -