The change event object is a reference to
the selected node.
So do:
evt.getProperty ("label")
or
evt.getProperty ("foo")
or
evt.getData().foo
Avoid using “backingObject”
Tracy
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Ramu p
Sent: Monday, October 10, 2005
3:17 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re:
getting to the selected Tree node
The below code solves ur
Prblem!!!
mx.controls.Alert.show("Label:"+event.target.selectedItem["backingObject"].label)
On 10/10/05, David
Aden <[EMAIL PROTECTED]>
wrote:
Oh, also tried:
evt.target.selectedNode
That does have a child "backingObject" which does have a child
"data" but that's empty.
d
On 10/9/05, David
Aden <[EMAIL PROTECTED]>
wrote:
I have been trying to get access to the item selected in a tree
from the change event. I've tried the suggestion from the documentation of:
evt.target.selectedItem.label
evt.target.selectedItem.data
I've also tried to go through the treeDataProvider:
evt.target.treeDataProvider.getProperty
("foo") [[[or getData()]]]
with no luck -- it comes back as undefined. I seem to be gettign to the object
as I can output:
mx.controls.Alert.show( evt.target.id );
mx.controls.Alert.show(evt.type );
but selectedItem doesn't seem to be available.
The tree itself is pretty straightforward:
<mx:Tree
id="securityTopNavSub" width="100%" height="0"
backgroundColor="0x3A4147" borderColor="0x3A4147"
change="
topNavViewHelper.showSecurity( event );">
<mx:dataProvider>
<mx:Array>
<mx:Object data=""
label="Systems" />
<mx:Object data=""
label="Documents" />
<mx:Object data=""
label="Incidents" />
</mx:Array>
</mx:dataProvider>
</mx:Tree>
I'm geting to the showSecurity() method, but as mentioned above, selectedItem
is not avaialble.
It seems like it must be something ridiculously simple, but I'm missing it. Any
suggestions welcome!
d
--
----------------------------------
David Aden
Webworld Technologies
--
----------------------------------
David Aden
Webworld Technologies
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO!
GROUPS LINKS
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS
|