Add and Delete Child Rows on Click
Add and Delete Child Rows on Click
potato_code
Posts: 14Questions: 5Answers: 0
Hi,
I'm trying to add and delete a child row each time a button is clicked. I can get one child row to show but I can't delete nor add another child row.
Any help would be greatly appreciated. Thank you
Live Test Case:
live.datatables.net/kozuzema/12/
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You are getting this error when clicking the delete row button:
You need to find the Datatables row containing the child. There may be better ways to do this or you may need to alter the code for your production solution but this is one example of how to traverse the DOM to get to the Datatable
tr
. You can use the browser's inspector to see the DOM structure.http://live.datatables.net/kozuzema/13/edit
Kevin
Hi,
Thanks for your answer. I thought this was the best way instead of add row since the child row data pertains to the parent row but I think I'm going to have to rethink my solution.
Hi,
Could I do an if /else statement where it checks if child row is already open. If it is open it adds another child row?