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?
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?
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?
This discussion has been closed.
Replies