1 Reply Latest reply on Dec 16, 2009 1:10 PM by Flex harUI

    Expand Tree after dataProvider loaded

    twitskull

      I need to expand all item in Tree control after data has been loaded using dataProvider.

       

      here is code

       

      public function loadTree():void
      {
          cursorManager.setBusyCursor();
          var conn:NetConnection = new NetConnection();
          conn.objectEncoding = ObjectEncoding.AMF3;
          conn.connect(this.Meta.gateway + "web/gateway.php");
          conn.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
          var resp:Responder = new Responder(onLoadTreeComplete, onFault);
          conn.call("Client.Disk.GetTree", resp);
      }

       

      private function onLoadTreeComplete(e:*):void
      {
          trvTreeview.labelField = "label";
          trvTreeview.dataProvider = e;
         // trvTreeview.expandChildrenOf(trvTreeview.dataProvider[0],true);
          cursorManager.removeBusyCursor();
      }

       

      This works only if I call this function by other event (such as some button click event) and not in complete event in netconnection.

       

      trvTreeview.expandChildrenOf(trvTreeview.dataProvider[0],true);

       

      How could this be done?