0 Replies Latest reply on Feb 11, 2008 8:42 AM by PhilBell

    Tree Control - lazy loading problem

    PhilBell
      I have a Flex Tree control to display the folder structure of what could potentially be a multi-depth structure. Given the need to return something quickly, i.e. at least the top level folders and 1 level down I have a 2 stage approach - I return the XML stream with the structure of the first 2 layers and then have a background call populate the full folder hierarchy and the deliver it back to the client. I then update the dataprovider to be the new XML stream and the Tree control collapses back to the unopened state. I suspect that as the XML returned by the second call may have subfolder information for what initially were empty folders the XML returned does not match the existing XML and the system resets itself.

      I have used the rendertree approach in an IM client to update the status of the user on the fly and the tree does not close down - however with the 2 xml trees being so different I cannot get it to behave in the same way.

      I have tried storing the open items and attempting to re-open them as per the renderTree one ( see Below) I used earlier but it does not work in this case.
      public function renderTree():void{
      if(refreshData){

      // Refresh all rows on next update.
      SampleTree.invalidateList();
      refreshData = false;
      SampleTree.openItems = open;
      // Validate and update the properties and layout
      // of this object and redraw it, if necessary.
      SampleTree.validateNow();
      }

      Can someone suggest a workaround for this?