2 Replies Latest reply on Sep 10, 2012 6:32 AM by Hitz_M

    Disable Items in a mx:Tree

    Hitz_M Level 1

      Hello,

       

      I want to disable certain items in a mx:Tree based on an attribute within the data XML. How can i achieve this.

      the mxml is:

       

      <fx:Declarations>

             

              <s:HTTPService id="TreeXML" url="E:\\Documents and Settings\\ipw\\Desktop\\789.xml" resultFormat="e4x"/>

              <s:XMLListCollection id="menuXML" source="{TreeXML.lastResult.node}" />

          </fx:Declarations>

       

      <mx:VBox label="Tree" width="100%" height="100%">

                  <mx:Tree id="MyTree" width="100%" height="100%"

                           allowMultipleSelection="false"

                           columnCount="1" defaultLeafIcon="{null}" folderClosedIcon="{null}"

                           folderOpenIcon="{null}"  showRoot="false"

                           dataProvider="{menuXML}"

                           labelField="@label">               

                  </mx:Tree>

      </mx:VBox>

       

       

      The XML is:

      <?xml version="1.0" encoding="utf-8"?>

      <Root>

          <node label="A" enabled="true"/>

          <node label="B" enabled="true">

              <node label="B.1" enabled="false"/>

              <node label="B.2" enabled="true"/>

          </node>

          <node label="C" enabled="false">

              <node label="C.1" enabled="false"/>

              <node label="C.2" enabled="true"/>

          </node>

      </Root>

       

       

      Thanks