DataTables Error - Uncaught TypeError: Cannot read property 'style' of undefined

DataTables Error - Uncaught TypeError: Cannot read property 'style' of undefined

Tina30Tina30 Posts: 1Questions: 1Answers: 0

I am getting an error when loading data tables with custom Jquery/JS. the error I am getting is below

Uncaught TypeError: Cannot read property 'style' of undefined
at Fa (jquery.dataTables.min.js:62)
at ga (jquery.dataTables.min.js:48)
at HTMLTableElement.<anonymous> (jquery.dataTables.min.js:93)
at Function.each (jquery-1.12.3.min.js:2)
at n.fn.init.each (jquery-1.12.3.min.js:2)
at n.fn.init.m [as dataTable] (jquery.dataTables.min.js:82)
at Object.<anonymous> (CDLDocsDSApp.js:1)
at i (jquery-1.12.3.min.js:2)
at Object.fireWith [as resolveWith] (jquery-1.12.3.min.js:2)
at y (jquery-1.12.3.min.js:4)

Can anyone help as I have checked the TH and TD tags and the Column span and Defs and still cannot get Data-tables to load within a private SharePoint site so unfortunately I cannot give a link to the page. I have also tried the debugger but this does not throw any errors at all.

Much Appreciated

Answers

  • kthorngrenkthorngren Posts: 21,147Questions: 26Answers: 4,918

    Generally I think that error means there is a config mismatch between the HTML table and Datatables. Without seeing your code its hard to say. Maybe you can post you Datatables init code and a sample of your HTML table. Make sure your Datatables init options don't access columns that don't exist, ie, column numbers start counting from 0.

    Kevin

  • galewinstongalewinston Posts: 1Questions: 0Answers: 0

    ‘Undefined’ is the property of the global object. This error occurs in Chrome Browser when you read a property or call a method on an undefined object . Uncaught TypeError: Cannot read property of undefined error is probably easiest to understand from the perspective of undefined, since undefined is not considered an object type at all (but its own undefined type instead), and properties can only belong to objects within JavaScript. There are a few variations of this error depending on the property you are trying to access. Sometimes instead of undefined it will say null. If you get undefined error, you need to make sure that which ever variables throws undefined error, is assigned a value to it.

  • dhutton@creativeone.comdhutton@creativeone.com Posts: 59Questions: 15Answers: 0

    Everytime we see the 'style' error which we internally refer to it it's because we have a mismatch somewhere between the js (editor and DT) and server side code (controller & model) and possibly the html (and the database of course). You're probably referencing a column in your front end code that doesn't exist in the backend code or db. If nothing looks obvious, eliminate columns until you find the culprit. It'll be one of them.

This discussion has been closed.