Uncaught TypeError: Cannot read property 'aoData' of null

Uncaught TypeError: Cannot read property 'aoData' of null

mzazmzaz Posts: 3Questions: 0Answers: 0
edited March 2014 in DataTables 1.9
I am trying switch over to using server side instead of client side processing of data for datatables.

I have an index.php file with a div(#pagecontent) that I load my dynamic content(page) in. Currently I only have one page with a dataTable.

When I load the page with dataTable it works fine, but if I switch to a different page and then back I get this error:

[quote]
Uncaught TypeError: Cannot read property 'aoData' of null jquery.dataTables.min.js:93
J jquery.dataTables.min.js:93
fa jquery.dataTables.min.js:27
fnGetPosition jquery.dataTables.min.js:106
ResponsiveDatatablesHelper.createExpandIcon datatables.responsive.js:390
task_Table.dataTable.fnRowCallback timecube.js:534
A jquery.dataTables.min.js:95
x jquery.dataTables.min.js:39
Fa jquery.dataTables.min.js:49
(anonymous function) jquery.dataTables.min.js:46
oSettings.jqXHR.$.ajax.success timecube.js:551
j jquery-2.1.0.min.js:2
k.fireWith jquery-2.1.0.min.js:2
x jquery-2.1.0.min.js:4
(anonymous function) jquery-2.1.0.min.js:4
[/quote]

Also the dataTable is stuck with processing and no rows.

I have tried out various methods of destroying the dataTable between page loads, but it doesn't seem to be a connection with that. I have also checked the json response from the server against jsonlint and it validates fine

I got this code from your debug bookmarklet: iseled
http://debug.datatables.net/iseled

Hopefully someone with experience with server side processing can point me in the right direction

Replies

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    I think we would need a link to the page to be able to offer much help with this one I'm afraid.

    It looks like there is something going wrong in your fnRowCallback function. Try commenting it out and seeing if server-side processing works without it. If so, then that is there to look.

    Allan
  • mzazmzaz Posts: 3Questions: 0Answers: 0
    Thanks Allan

    Commenting out fnRowCallback makes everything work.

    I have been trying to add a responsive plugin to dataTables, and it seems there might be problem related to this.

    [code]
    "fnRowCallback" : function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
    if (responsiveHelper) {
    responsiveHelper.createExpandIcon(nRow);
    }
    },
    [/code]
  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    We'd need a link to a test case showing the issue.

    Allan
  • mzazmzaz Posts: 3Questions: 0Answers: 0
    The fix for my problem was to properly clear the responsiveHelper function.
    [code]
    if (responsiveHelper){
    responsiveHelper.disable(true);
    }
    responsiveHelper = undefined;
    [/code]

    Currently I run this first on every menu click, to make sure it is reset
This discussion has been closed.