mercredi 15 février 2017

Checkbox states in multi-selectable tree component in angular

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:

  1. when a root node is selected/unselected all nodes must be selected/unselected including the parent nodes
  2. when a only a few nodes are selected then the parent checkbox should turn into indeterminate, same for root node
  3. 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.

http://ift.tt/2kAuIy4




Aucun commentaire:

Enregistrer un commentaire