PDA

View Full Version : Disabling Tree nodes



coooolmagic
7 Sep 2010, 8:05 AM
Hi All

I have a requirment where i need to show complete tree structures to users but they can only select / highlight a node and its children only.

So lets say

--ROOT
---- Node A
-- Node AA
---- Node B
.... sub tree nodess....
---- Node C
---- NOde CC
---- Node CCC

I want to allow users to be able to only select Node C and its children.. for rest i want to restrict however they can expand it to see it..

please point to a right direction..

Condor
7 Sep 2010, 9:04 AM
Write a beforeselect event handler for the treepanel selection model that return false if the node shouldn't be selected.

coooolmagic
8 Sep 2010, 12:36 AM
thanks!

is there any easy way to find parent of a node?

i.e. i would like to check if CCC is a child of C node...

Condor
8 Sep 2010, 12:42 AM
A node has a parentNode property, but you could also use the bubble method with a compare function.