row child
row child
Ohunjon
Posts: 9Questions: 5Answers: 0
please help me friends!
I have ready table with data and some rows has nested table (like this)) but with ready data, and all of data was renderind with python in my html page. i want here use DataTable and to bind nested table. If i use datatable without nested table it works, else returned so error: (TypeError: Cannot set property '_DT_CellIndex' of undefined). how can I resolve this problem ?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
If you search the forum you will probably find that this is typically due to having a mismatch in the number of columns in your
table
and what you have defined in your Datatable. Its hard to say what the issue is without seeing your page or a test case replicating the issue.https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
@kthorngren thanks for answer. I try to detailed: here is example code the logic almost is same as my project. I have alredy all data from api ( with python ) and render it in html page. without nested table lib DataTable is worked ok, but with nested table DataTable is not working returned as i said so errror: TypeError: Cannot set property '_DT_CellIndex' of undefined. how can i bind nested tables as a child row table? in the documentation situation a bit different because in documentition was using format() method or nested table created in other ways, but in my project is ready nested table. how can solve this issue ? please help me!
The problem is that Datatables doesn't support using
colspan
(orrowspan
) within thetbody
of the table. This row is not supported by Datatables:The
colspan
is causing the'_DT_CellIndex' of undefined
error.One option is to not generate these rows in your Python code and use an ajax request to get the child row information. This process is outlined in this doc:
https://datatables.net/blog/2017-03-31
Another option is to not have Python generate the table into the returned HTML page but let Datatables request the data using
ajax
and have have Python return the full row data set then use the [Child Rows(https://datatables.net/examples/api/row_details.html) example as documented.
Kevin
so, If DataTable is not support colspan or rowspan. I will have to try get data with ajax from my api.
Thank you very much Kevin!