1 Reply Latest reply on Jun 11, 2008 11:46 AM by johighley

    Tree issue with custom DataDescriptor

      Flex 3. I have a Tree control using an XMLListCollection as its data provider. The collection in turn uses a bindable XML object for its data provider. The collection is needed to filter the xml and do a sort.

      The XML is retrieved as needed from a server with HTTPService. I wrote a custom data descriptor with a getChildren method that retrieves a branch's children when the branch is expanded. The getChildren method returns an empty XMLListCollection. The ResultEvent.RESULT handler for the HTTPService handles appending the server response to the XML object (per above: XML object is data provider for XMLListCollection which is data provider for the Tree).

      The issue I'm having is that as soon as I click on the Tree branch to expand it, the getChildren() method is immediately called 2 times with the same node parameter. I've commented out the server call to take that out of the equation. The first call to getChildren() finishes and then appears is immediately called again with the same params. I'm not sure how to debug whatever is calling getChildren.....

        • 1. Re: Tree issue with custom DataDescriptor
          johighley Level 1
          some additional info: I tried using the XML object directly as the Tree data provider, but still had the same issue.

          I also commented out everything in getChildren() so it just returns a new empty XMLListCollection

          If I expand node A in the tree, getChildren() is called 2 times with node A. If I then expand node B, getChildren() is called 4 times: A, B, A, B.

          Also, if I scroll the tree, getChildren() is called 2 times for every open branch. Is there any way to turn off the calls when scrolling? The server is going to be bombarded with requests for the same exact information. I could put a check in getChildren() to see if results for the branch have already been returned, but the 2 calls per branch happen so quickly, the first server call hasn't returned by the time the second method call is made.