Uncaught TypeError: Cannot read property 'length' of undefined

Uncaught TypeError: Cannot read property 'length' of undefined

abdullah.nassar1000@gmail.comabdullah.nassar1000@gmail.com Posts: 1Questions: 1Answers: 0
edited October 2018 in Free community support

I'm getting that error while i'm using datatables and i'm getting the data from database with ajax code
Uncaught TypeError: Cannot read property 'length' of undefined
at Ia (jquery.dataTables.min.js:24)
at HTMLTableRowElement.<anonymous> (jquery.dataTables.min.js:17)
at jQuery-2.1.4.min.js:2
at Function.map (jQuery-2.1.4.min.js:2)
at n.fn.init.map (jQuery-2.1.4.min.js:2)
at na (jquery.dataTables.min.js:16)
at e (jquery.dataTables.min.js:92)
at HTMLTableElement.<anonymous> (jquery.dataTables.min.js:93)
at Function.each (jQuery-2.1.4.min.js:2)
at n.fn.init.each (jQuery-2.1.4.min.js:2)

## the code is included in the attached file

Answers

  • kthorngrenkthorngren Posts: 20,297Questions: 26Answers: 4,769

    I might be missing it but I don't see where you are initializing Datatables in the attached code.

    Cannot read property 'length' of undefined

    This could be due to the Datatables config referencing a column index that is not in the table. Without seeing the problem and what the generated tables look like its hard to diagnose. Can you post a link to your page or a test case replicating the issue?
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

This discussion has been closed.