I'm working on creating a straightforward menu that allows users to click on a parent checkbox to expand or collapse its children. The challenge I'm facing is how to make the parent checkboxes expand while hiding the children items within them when clicked. Here's what I want the outcome to look like:
https://i.sstatic.net/sIGlk.png
Below is the function I've created for selecting or unselecting:
selectUnselectAll(obj) {
obj.isAllSelected = !obj.isAllSelected;
// tslint:disable-next-line:prefer-for-of
for (let i = 0; i < obj.ParentChildchecklist.length; i++) {
obj.ParentChildchecklist[i].isSelected = obj.isAllSelected;
// tslint:disable-next-line:prefer-for-of
for (let j = 0; j < obj.ParentChildchecklist[i].choices.length; j++) {
obj.ParentChildchecklist[i].choices[j].isSelected = obj.isAllSelected;
}
}
}
This link takes you to the entire application:
Currently, my dressing and bread lists do not collapse at all. How can I make the children also collapse?
Any guidance on achieving this would be greatly appreciated.