3 Replies Latest reply on Jun 9, 2010 8:47 AM by Flex harUI

    How to disable disclosureClosedIcon on a tree for a particular node ?

    MoreGart111

      How can I selectively disable the disclosureClosedIcon in  front of a particular tree node and leave the other tree nodes unaffected. If I do

      myTree.setStyle("disclosureClosedIcon",null);

       

      Then the whole tree is affected. Please look at the code below.

       

       

       

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

       

       

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

       

       

      <mx:Application

       

      xmlns:mx="http://www.adobe.com/2006/mxml">

      <mx:Script>

      <![CDATA[

       

       

      import mx.events.ListEvent;

       

      import mx.controls.Alert;

       

      import mx.events.TreeEvent;

      [

      Bindable]

       

      public var selectedNode:XML;

       

       

       

      public function myTreeOpening(event:TreeEvent):void {

       

      //How to do the following selectively just for one node. For example if I want to just disable

       

       

      //further opening of "Marketing" node and leave the other two

       

      Alert.show(

       

      "Trying to disable the disclosureClosedIcon just for the Marketing node");

       

       

      //myTree.setStyle("disclosureClosedIcon",null);

      }

      ]]>

      </mx:Script>

       

      <mx:XML

       

      id="treeData">

      <node label="Mail Box">

      <node label="Inbox">

      <node label="Marketing">

      <node label="Professional"/>

      <node label="Individual"/>

      <node label="team"/>

      </node>

      <node label="Product Management">

      <node label="Professional"/>

      <node label="Individual"/>

      <node label="team"/>

      </node>

      <node label="Sales">

      <node label="Professional"/>

      <node label="Individual"/>

      <node label="team"/>

      </node>

      </node>

      </node>

      </mx:XML>

       

      <mx:Panel

       

      title="Tree Control Example" height="75%" width="75%" paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">

       

       

      <mx:Label width="100%" color="blue" text="Select a node in the Tree control."/>

       

       

      <mx:Tree id="myTree" width="50%" height="100%" labelField="@label"

      showRoot="

      false" dataProvider="{treeData}" itemOpening="myTreeOpening(event)"/>

      </mx:Panel>

       

      </mx:Application>