To examine the node clicked you can listen for ListEvent.ITEM_CLICK in the Tree 
and check the event data.
You can  then use the scan selectedItems array and remove any that dont belong.

- Ivo




________________________________
From: biosmonkey <biosmon...@yahoo.com>
To: flexcoders@yahoogroups.com
Sent: Tuesday, December 23, 2008 11:50:42 AM
Subject: [flexcoders] Deselecting tree nodes based on some condition


I am using the tree view in an advanced data grid.

The nodes in the tree can be any kind of parent/child relationship,
and each node is one of a few different types.

So for example, let's say you have a tree consisting of nodes that are
one of 5 different types A,B,C,D,and E.

If the user first clicks on a node of type B, then I need to limit all
future selections to type B by deselecting or preventing the user from
clicking them. This needs to work whether the user ctrl-clicks
individual nodes, or shift-clicks a whole bunch of nodes. 

So, in essence I don't care about any parent/child relationships. ..if
the user shift-clicks across a large number of parents and children I
still treat them as individual nodes.

So, I just need to a) see what the first type is that they clicked and
b) scan any other selected items and deselect them if they are not the
same type.

I tried messing around with the selectedItems array, but I could not
seem to alter it.  I am also not sure how much code *I* need to do to
make this work, ie can I remove an entry from the selectedItems array
and Flex deselects it for me, or do I have to do everything?

    

Reply via email to