Removing Childrow of DataTable via button.
Removing Childrow of DataTable via button.
Mairinabrandon
Posts: 8Questions: 2Answers: 0
Good day, i'm about to delete/remove the selected row of datatable via button inside its current row. when i try
table.row($(this).parents('tr')).remove().draw();
it works fine when no child row hidden, but when i try to execute those codes when there is a child row hidden the row does not remove at all, need to re open the table to take effect.
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Guessing you are using the Responsive extension. If so then
$(this).parents('tr')
won't be the correct path to the parent row. When the button is in a Responsive child row right click on it and click Inspect. Look at the path to the parent. You can usecolumn().responsiveHidden()
to determine if the column the button is in is hidden by Responsive to decide what to use to get the parent row. Here is an example:http://live.datatables.net/xijecupo/160/edit
If this doesn't help then please provide a link to your page or a test case so we can see what you have. This will allow use to offer suggestions to help.
Kevin
this works for me Sir kthorngren,.
var table = $('#myCart').DataTable();
Thank you so much for the example
What exactly is not working?
The
column().responsiveHidden()
docs state this about the return value:The return results seem opposite of the API name. I think you will want this instead:
If this doesn't help then please provide a link to your page or a test case (or update mine) so we can take a look at what you have.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin