true, however i was not assuming each node had the seconde attribute, come to think of it it would not matter. So; yes this is better then a custome renderer..
 
:)
 
Jason
-----Message d'origine-----
De : flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]De la part de Joan Tan
Envoyé : lundi 20 mars 2006 18:17
À : flexcoders@yahoogroups.com
Objet : RE: [flexcoders] Flex 2 Tree Behaviour override

If you are still using just text for each node in your tree, then, you don’t need to do a custom itemRenderer. Instead, you can just use a labelFunction. So, on your Tree tag, just add something like labelFunction=”returnLabel”. Then, you will have a returnLabel function that looks something like this:

 

private function returnLabel(item:Object) : String

{

    var str:String [EMAIL PROTECTED] + " " + [EMAIL PROTECTED];

    return str;

}

 

Joan

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of yair_iny
Sent: Monday, March 20, 2006 3:51 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex 2 Tree Behaviour override

 

Hi,

I am evaluating Flex 2 Beta in comparison with Laszlo, in order to
make a choice on an RIA framework for our company.

As part of this evaluation I am trying to modify the Tree control
behaviour, to allow me to display structured text from more than one
XML attribute in my data source.  I have tried doing this using
ListItemRenderer but it stops displaying all of the standard tree
behaviour as soon as I override it.

Does anyone know how to do this?  Are there any examples of the tree
bahaviour being overriden?

Below are the sources for the two MXML files.

Thanks,
Yair Iny

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml"
xmlns="*" layout="vertical">

      <mx:XML id="TreeXML">
            <folder name="Inbox" num="100">
                  <item name="Item1" num="50"/>
                  <folder name="Junk" num="20">
                        <item name="Item2" num="25"/>
                  </folder>
            </folder>
      </mx:XML>

      <mx:Panel width="638" height="425" layout="absolute"
title="Problem View Mockup">
            <mx:Tree dataProvider="{TreeXML}" rootVisible="false"
width="598" height="373" listItemRenderer="MyTreeRenderer">
            </mx:Tree>
      </mx:Panel>
</mx:Application>


<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*">
      <mx:Label id="Name" text="[EMAIL PROTECTED]"/>
      <mx:Label id="Count" text="[EMAIL PROTECTED]"/>
</mx:HBox>










--
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




Reply via email to