Skip to content
Advertisement

Cannot read property ‘cell’ of undefined using data table

I was trying to apply datatable in asp.net but it throwing the error the code used for applying datatable. What I should do to solve my problem. I am searching but I didn’t find anything to solve it. I am looking forward to your advice. Thank you.

JavaScript

Error:

jquery.min.js:2 Uncaught TypeError: Cannot read property ‘cell’ of undefined at fa (jquery.dataTables.min.js:28) at ha (jquery.dataTables.min.js:48) at e (jquery.dataTables.min.js:93) at HTMLTableElement. (jquery.dataTables.min.js:93) at Function.each (jquery.min.js:2) at w.fn.init.each (jquery.min.js:2) at w.fn.init.n [as dataTable] (jquery.dataTables.min.js:83) at w.fn.init.h.fn.DataTable (jquery.dataTables.min.js:165) at HTMLDocument. (Index:1717) at l (jquery.min.js:2)

Advertisement

Answer

There are several issues :

  • You have a mismatch between the number of header columns and body columns. They must be exactly the same.

  • If you want complex headers you must place the descriptive header (the header with captions matching all columns) as the very last (not first as above)

  • Playing with column visibility in inline CSS is a totally nogo. Why <th style="display:none"> anyway? Columns should be hidden with visible: false

So basically: Turn the <tr>‘s in your <thead> section upside down and stop trying to manipulate visibility in CSS.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement