5 Replies Latest reply on Sep 15, 2010 12:58 AM by TomBurgundy

    Tree display not updating when adding first node to expanded node

    TomBurgundy Level 1

      Hi

       

      Please have a look at the following code. To reproduce the faulty behaviour you have to expand the item, then click "add" button and observe, that nothing happens. Collapsing, then expanding the node shows the added children. I use Flex 3.5.0

       

      Is this a bug in the SDK or am I missing some auto update switch?

       

      Thanks!!

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" 
           minWidth="955" minHeight="600"
           creationComplete="run()">
           
           <mx:Tree id="tree" width="300" height="500" labelField="name" />
           
           <mx:Button label="add" click="onClickAdd()" />
           
           <mx:Script>
                <![CDATA[
                     import mx.collections.ArrayCollection;
                     import mx.utils.ObjectProxy;
                     
                     protected var itm1:Object;
                     
                     
                     protected function run() : void
                     {
                          var ac:ArrayCollection = new ArrayCollection();
                          
                          this.itm1 = new ObjectProxy({name:"1", children:new ArrayCollection()});
                          ac.addItem(this.itm1);
                          this.tree.dataProvider = ac;
                     }
                     
                     
                     protected function onClickAdd() : void
                     {
                          this.itm1.children.addItem({name:"child"});
                     }
                ]]>
           </mx:Script>
           
      </mx:Application>