Selecting Nested Table Checkboxes
Selecting Nested Table Checkboxes
Hello,
Go to the test case first, cause the futher description is kinda hard to understand, without knowing context, thanks.
What I am trying to achieve is :
- A Select All Button to Select All Inner Table Check Boxes, as well as all parent rows of inner tables
- A Row by Row Selection for parent rows to select all inner checkbox of table in that specific row
- This ties into the previous one, when all rows in an inner table have been selected, the parent row for that table is also checked, otherwise its not
I have created the test case: Test Case
From the list above, if the header check box is selected, then everything else is also selected, including inner tables.
If a Parent Row is checked, then all inner table rows will also be checked for that single row.
When all Rows for a specific inner table is checked, then the parent row the table is nested in, will also be checked, other wise it's not.
Thanks
This question has an accepted answers - jump to answer
Answers
Also I did notice just now, when I check any one of the inner table check boxes, and open and close the row, it unchecks the inner table checkbox i originally checked, not sure what to do about that.
Anybody have a solution?
This isn't something I've tried to do before I'm afraid, as DataTables doesn't have a true tree view mode. However, it will be possible and what I think you should do is have a data property (called
checked
or something like that) for each row on the parent and child table. It is that which would be toggled and the table would be updated (invalidated) to reflect the state.Or another way of putting it - don't attempt to store the checked state in the DOM (since when the child row is hidden, the child table is removed). Instead store it in the data object for each row.
Allan
Okay thanks @allan, if you wouldnt mind, could you pls help with the test case, you dont have to do all rows, just one row is fine, ill carry it across all other rows, i just dont know how to approach this as its nested. Thanks again. Here is the test case Test Case
Sure, that would be something that would fall under our paid support options.
Allan