Debug Codes Added -- Uncaught TypeError: Cannot read property 'style' of undefined

Debug Codes Added -- Uncaught TypeError: Cannot read property 'style' of undefined

seamanjeffseamanjeff Posts: 8Questions: 1Answers: 0
edited October 2013 in General
I wouldn't be able to get problem demonstrated in JS Fiddle without a few days work boiling it down to a trivial case -so I hope you can maybe help me anyway.

I am using DataTable with a table that I built in the DOM with some AJAX code. Then, I want to refresh the tables. When I call DataTables for the second time, after all the TRs have been deleted and added again, it dies like this:

[code]Uncaught TypeError: Cannot read property 'style' of undefined jquery.dataTables.js:3654
_fnCalculateColumnWidths jquery.dataTables.js:3654
_fnInitialise jquery.dataTables.js:2609
(anonymous function) jquery.dataTables.js:6793
jQuery.extend.each jquery.js:648
jQuery.fn.jQuery.each jquery.js:270
DataTable jquery.dataTables.js:6366[/code]

The call looks like this:

[code] scheduleTable.dataTable({
"bDestroy": true,
"bPaginate": true,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": true,
"bAutoWidth": false,
"bJQueryUI": true
});[/code]

Replies

  • seamanjeffseamanjeff Posts: 8Questions: 1Answers: 0
    So here's the debug code: uguxeg for before I click refresh and get the error.

    And here's the debug code after I hit refresh: efexih

    Hope this helps.
  • seamanjeffseamanjeff Posts: 8Questions: 1Answers: 0
    fwiw calling fnDestroy on the table before reinitializing it seemed to fix this.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Are you changing the number of column in the table? Good to hear that you have a work around! How are you now calling fnDestroy? It sounds like something I should fix in DataTables...

    Allan
This discussion has been closed.