Getting aoData is null error but not using server data
Getting aoData is null error but not using server data
ursasmar
Posts: 6Questions: 0Answers: 0
I am using aaData, but it's built on the client side. I keep getting the error:
[quote]Uncaught TypeError: Cannot read property 'aoData' of null [/quote]
This is my datatables definition
[code]
var oTable = $('#report-table').dataTable( {
'bFilter': false,
'bSort': false,
'bPaginate': false,
'bInfo': false,
'bServerSide': false,
"aaData": results,
"aoColumns": colHeaders,
"bSort": false,
"sDom": 'T<"clear">Rlfrtip',
"oTableTools": {
"sSwfPath": "/media/swf/copy_cvs_xls_pdf.swf",
"aButtons": [{
"sExtends": "collection",
"sButtonText": "Tools",
"aButtons": ["pdf","copy",
{
"sExtends": "text",
"sButtonText": "Show Columns",
"fnClick": function ( nButton, oConfig, oFlash ) {
showColumns();
}
}]
}]
},
"fnInitComplete": function(oSettings, json) {
var td = "",
footer = $('' + td.repeat(columns.length) + '');
footer.insertAfter($(this).children('tbody'));
//print totals and whatnot in the footer
fillFooter();
// fill in all the sub rows, subtotal, subavg, etc
subRows();
},
"fnCreatedRow": function(nRow, aData, iDataIndex ) {
if (aData[groupCol] != lastGroup) {
lastGroup = aData[groupCol];
} else {
$(nRow).children('td:first').text('');
}
//assign the field formats
for (var i = 0, count = colInfo.length; i < count; i++) {
if (colInfo[i].colFormat !== null) {
$(nRow).children('td').get(i).setAttribute('data-format', colInfo[i].colFormat);
}
}
},
// put the name of the report in the header of the table
"fnHeaderCallback": function( nHead, aData, iStart, iEnd, aiDisplay ) {
$(nHead).before('' + $('body').data('reportName') + '');
}
} );[/code]
[quote]Uncaught TypeError: Cannot read property 'aoData' of null [/quote]
This is my datatables definition
[code]
var oTable = $('#report-table').dataTable( {
'bFilter': false,
'bSort': false,
'bPaginate': false,
'bInfo': false,
'bServerSide': false,
"aaData": results,
"aoColumns": colHeaders,
"bSort": false,
"sDom": 'T<"clear">Rlfrtip',
"oTableTools": {
"sSwfPath": "/media/swf/copy_cvs_xls_pdf.swf",
"aButtons": [{
"sExtends": "collection",
"sButtonText": "Tools",
"aButtons": ["pdf","copy",
{
"sExtends": "text",
"sButtonText": "Show Columns",
"fnClick": function ( nButton, oConfig, oFlash ) {
showColumns();
}
}]
}]
},
"fnInitComplete": function(oSettings, json) {
var td = "",
footer = $('' + td.repeat(columns.length) + '');
footer.insertAfter($(this).children('tbody'));
//print totals and whatnot in the footer
fillFooter();
// fill in all the sub rows, subtotal, subavg, etc
subRows();
},
"fnCreatedRow": function(nRow, aData, iDataIndex ) {
if (aData[groupCol] != lastGroup) {
lastGroup = aData[groupCol];
} else {
$(nRow).children('td:first').text('');
}
//assign the field formats
for (var i = 0, count = colInfo.length; i < count; i++) {
if (colInfo[i].colFormat !== null) {
$(nRow).children('td').get(i).setAttribute('data-format', colInfo[i].colFormat);
}
}
},
// put the name of the report in the header of the table
"fnHeaderCallback": function( nHead, aData, iStart, iEnd, aiDisplay ) {
$(nHead).before('' + $('body').data('reportName') + '');
}
} );[/code]
This discussion has been closed.
Replies