Uncaught TypeError: Cannot read property 'style' of undefined (v1.10.12)

Uncaught TypeError: Cannot read property 'style' of undefined (v1.10.12)

KuroKuro Posts: 2Questions: 1Answers: 0

Looking around it seems like this error occurs when the HTML column count and the column definition for DataTables do not match. I recently updated from 1.10.0 to 1.10.12 to move from Table Tools to Buttons to enhance some export functionality and this problem started cropping up.

Spent a couple of days looking for a solution, but can't seem to get this resolved.

Here's a (minimal) fiddle with the error included:
https://jsfiddle.net/5a2oz62y/2/

Unless I'm missing something, I've got 5 columns in both sides of the table definition, but the error persists despite it looking like the style is being applied. In the actual application the error is blocking follow-on functionality. Can't help but feel like I'm overlooking something obvious.

Thanks in advance.

This question has an accepted answers - jump to answer

Answers

  • NineForty5NineForty5 Posts: 9Questions: 0Answers: 2
    Answer ✓

    Remove dom option since it's not defining anything, then the table displays properly.

    $("#SearchResultsTable").DataTable({
       "destroy": true,
       "scrollY": "200px",
       "scrollCollapse": true,
       "paging": false,
       "data": models,
       // REMOVE --> "dom": '',
    
  • KuroKuro Posts: 2Questions: 1Answers: 0

    I had been using the empty dom parameter to remove the additional formatting DataTables provides, but I guess this version doesn't care for it.

    Marked as answer. Thanks kindly.

  • allanallan Posts: 61,726Questions: 1Answers: 10,109 Site admin

    The absolute minimum for the dom property is for it to be 't' (i.e. the table).

    Allan

This discussion has been closed.