Michael, thanks for the tree suggestions. 
 
To resolve the issue I had to add the @label along with the showRoot = false attribute on the tree control.  I have included example code for others that may be experiencing tree problems.
 
Josh
 
<mx:Tree id="menuItemsTree" labelField="@label" showRoot="false"/>
 
  //Note menu is a ArrayColleciton from a remoteObject that returns the XML as a single string called menu_xml_string
  public static function formatMenuXmlForTree(menu:ArrayCollection):XMLDocument{
       var menuXMLDocument:XMLDocument = new XMLDocument();
       menuXMLDocument.parseXML(menu.getItemAt(0).menu_xml_string);
       menuItemsTree.dataProvider = menuXMLDocument;
  }

Sample XML
<?xml version="1.0" encoding="utf-8"?>
 <menuitems>
    <menuitem menuID="70" label="Letters">
       <menuitem menuID="71" label="A" />
       <menuitem menuID="72" label="B" />
       <menuitem menuID="73" label="C" />
    </menuitem>
    <menuitem menuID="74" label="Numbers">
       <menuitem menuID="75" label="1"/>
       <menuitem menuID="75" label="2"/>
       <menuitem menuID="75" label="3"/>
    </menuitem>
 </enuitems>

 

To: flexcoders@yahoogroups.com
From: [EMAIL PROTECTED]
Date: Thu, 18 May 2006 22:10:16 +0000
Subject: [flexcoders] Re: Flex 2b3 - Tree Problems

--- In flexcoders@yahoogroups.com, "porsoc" <[EMAIL PROTECTED]> wrote:
>
> I have a string of valid XML that I want to show in a tree control.  I
> can not get the tree to render my XML.  All it will show me is one
> node with the entire XML string as the label.
>
> Isn't a control is supposed to be able to render an XMLDocument
> correctly.
>
> Anybody see what I am doing wrong below?
>
> public function setMenuInTree(menu:ArrayCollection):XMLDocument{
>       var menuXml:XMLDocument = new XMLDocument(menu.getItemAt
> (0).menu_xml_string);
>      
>       menuItemsTree.dataProvider = menuXml;
> }
>

Make sure that you've set a labelField on the Tree in the form of
'@attributeName', for example labelField="@label".

Also verify that your data confirms to the requirements of the
DefaultDataDescriptor or else you'll need your own impl of
ITreeDataDescriptor. 

You might also verify that your XML string can be parsed into XML by
trying something like:

myXMLTest:XML = new XML("<myXMLString/>");

HTH,

Michael





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS





Express yourself instantly with MSN Messenger! MSN Messenger

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to