DataTables AJAX source example - array of objects as a data source is not fully complete?

DataTables AJAX source example - array of objects as a data source is not fully complete?

keirlav87keirlav87 Posts: 11Questions: 0Answers: 0
edited February 2012 in General
I have a php script that returns json in the exact format as shown the 'array of objects' example however i get the following error message -

DataTables warning (table id = 'dataTable'): Added data (size undefined) does not match known number of columns (7);

and my init code looks like this ->

var oTable = $('#dataTable').dataTable({
"bProcessing": false,
"sAjaxSource": 'csv-reader.php',
"aoColumns": [
{ "mDataProp": "Agent" },
{ "mDataProp": "Target" },
{ "mDataProp": "Packs Out" },
{ "mDataProp": "PPI" },
{ "mDataProp": "CC PPI" },
{ "mDataProp": "CCC" },
{ "mDataProp": "Totals" }
],
} );

I know that the problem lies in my column titles being the index of each column value, but in the example they do nothing further with the json in order to trim the column title from the json before using it - can anyone explain what I need to do please?

Replies

  • keirlav87keirlav87 Posts: 11Questions: 0Answers: 0
    Sorry! Problem solved, I was using an older version of datatables that did not allow for an array of objects to be passed as its datasource
This discussion has been closed.