TypeError: Cannot set properties of undefined (setting '_DT_CellIndex')
TypeError: Cannot set properties of undefined (setting '_DT_CellIndex')
Rupesh Bharuka
Posts: 9Questions: 1Answers: 0
Error messages shown:
TypeError: Cannot set properties of undefined (setting '_DT_CellIndex')
Description of problem:
In a dataTable that has 0 entries, but has a column with no title or a title of just ( ). (For example a column for action buttons that has no title), this causes a JS error like in original report.
This issue is immediately resolved once the amount of rows in table is greater than 0.
Replies
Sounds like your table doesn't meet the requirements of what Datatables needs. See the HTML docs. Please provide a link to your page or a test case replicating the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Got it. I've changed my code a bit. Now, I'm getting this error because of colspsan that I've used in my tbody. The below example is the exact same scenario, kindly refer to it & guide me accordingly. Thanks
Demo Link: http://live.datatables.net/rexixevu/60/edit
DT does not support colspan in a tbody.
https://datatables.net/manual/installation#HTML
do we have any workaround to this issue or we shall keep it as is and wait for the client to add at least 1 record to the table to get rid of this issue?
You can show an empty table. You can use
language.emptyTable
to change the text displayed when the table is empty.Kevin
@kevin I personally didn't like this approach. Instead, datatable should address this issue of colspan in tbody as the issue is faced by multiple users. And, I think this should be taken as a high priority issue because this is a basic functionality of a table when it comes to web application.
Also, what is strange here is, datatable doesn't support colspan in table body but it supports the same in the table header and footer according to @tangerine above. But, when it comes to the arrangement of data in a table, we do that in the table body. The rest is just a piece of decorative information. So, according to me, this is a must fix in a data table library. Correct me, if I'm wrong.
Thanks, Rupesh
I think the main reason for not supporting
colspan
androwspan
in thetbody
is for sorting and searching. Having either of these would make it more complex and would make it more complex for developers to create custom searching and sorting plugins.Kevin
Yep, you're wrong As Kevin said,
colspan
androwspan
in the table body would significantly impact ordering and filtering, so it's not something that's going to happen in the short-term.Colin
Oh, thanks @kthorngren and @colin for the clarification on this. I completely agree with both of you & understand the significant impact on ordering and filtering features of the data table.