I'm building a tree component but having a hard time maintaining the checkbox state of root/parent/leaf nodes depending the selection.
Basically the functionality that I'm trying to achieve is what you'd typically expect in a tree. Here's what I need to do, just in case:
- when a root node is selected/unselected all nodes must be selected/unselected including the parent nodes
- when a only a few nodes are selected then the parent checkbox should turn into
indeterminate
, same for root node - When a parent node is clicked all nodes under it should be selected and root checkbox should turn into
indeterminate
. When all parent nodes are selected, the root node checkbox should be checked
I have created plunker that shows the tree component. Can anybody please share some working example. I appreciate your time.
Aucun commentaire:
Enregistrer un commentaire