lundi 26 janvier 2015

ZK Tree Listener for checking/unchecking checkboxes from the trees checkable attribute

I'am using ZK 7.0.3 with MVCand have successfully implementet a Tree and its children programmatically via creating the components and appending them on the wired tree.


I have a structure like this where [ ] is the Checkbox from the trees checkable attribute:



[] Treegroup1
[] SubitemFromTreegroup1
[] SubitemFromTreegroup1
[] SubitemFromTreegroup1
[] Treegroup2
[] SubitemFromTreegroup2
[] SubitemFromTreegroup2
[] SubitemFromTreegroup2


etc.


I want to implement a Listener that does the following:



  • if a Group is checked all Children of that Group are checked too.

  • if a Group is unchecked all Children of that Group will uncheck too.

  • if a all children of a group are checked manually the Group will check too.

  • if at least one child is unchecked the group is unchecked too.


But putting a listener on a treeitem dosen't seem to work, I read the doc a little and tried a listener for the whole tree onSelect which fires on every select but dosen't know which element is the source which is kind of annoying because I'am unable to get all four behaviours listed above to work.


Is there a way to add a listener to single items or to retrive the event source Treeitem in the tree listener?





Aucun commentaire:

Enregistrer un commentaire