Getting selectMode 3 behavior on "certain" nodes in FancyTree

28 views Asked by At

I have a FancyTree data structure where I want selectMode 3 behavior on most parents, but a few are exceptional cases where the parent should be selectable independently from its children (basically selectMode 1 behavior only on these). I have an array of node keys defined corresponding to parent nodes whose state should be independent of their children.

-node 1 --Exceptional node 1.1 // When I check this... ---node 1.2 // ...this should not check, but should require parent -node 2 --node 2.1 // But this node should select its parent ---node 2.2 // Should select parents

I have tried setting selectMode to 3 and using the select method to loop through its children, setting them to false, but this seems to automatically uncheck the parent again -- resulting in no visible behavior.

I suspect I may need to set selectMode to 1 for the whole tree and trigger selectMode 3 behavior upwards through the tree on my normal nodes. Then I simply deny this trigger to my exceptional nodes. I'm not sure how to code that. Is there a method that can cascade selectMode 3 behavior from a selected node upwards through its parents?

Please, advise.

Edit: I'm considering another approach. Maybe the child element should be structured as a sibling instead. I only need to indent it so that it "appears" to be a child. Then I can use the select method to intercept selection of one to control the other. How can I add custom indentation to a sibling element so that it looks like a child?

0

There are 0 answers