3 Replies Latest reply on Dec 16, 2008 2:10 AM by ephemerian

    ITreeDataDescriptor can't support multiple child branches?

    jonesf
      So, here's my question of the day.... I'm trying to keep it down to one per day ;-)
      I'm creating a custom datadescriptor with an AS class that implements ITreeDataDescriptor. I'm using AS objects as my data source, not XML.

      Let's say have an AS class called "School". School has two properties, both of which are collections, called "Teachers" and "Students".
      So, using code like that in Exhibit A, gives me a tree like Exhibit B, but I want (and expected) it to look like Exhibit C.
      The ["children"] of my dynamic objects that I create in getChildren() are never passed back to the data descriptor.

      It seems like the only thing I can do is something like Exhibit D. How can I create my own collection based branches using a custom data descriptor? I know how I can do this by creating a whole new object graph and using the DefaultDataDescriptor, but I'm trying to avoid that.
      Ideas?
      Thanks!


        • 1. Re: ITreeDataDescriptor can't support multiple child branches?
          jonesf Level 1
          I've spent a lot of time on this and am out of ideas. No ideas?
          • 2. Re: ITreeDataDescriptor can't support multiple child branches?
            jonesf Level 1
            Well anyway, I ended up writing some classes that wrap my objects to simulate the default handler that expects everything to have label/children properties. A big pain in the rear, but seems to be working. I still think it's unnecessary, but was the only way I could get it to work after spending a ridiculous amount of time on it. Seems like it should be the most basic of tree control functionality. Anyway, the code is kind of specific to my data model so no sense in posting it here. But if anyone else has this problem, post here and I'll do my best to help.
            • 3. Re: ITreeDataDescriptor can't support multiple child branches?
              ephemerian
              Hi,
              I think I'm having a similar problem. I have an implementation of ITreeDataDescriptor, and my tree expands as far as the first level nodes. Using trace(), I can see that the hasChildren() method is being called for the second level nodes and returns true, but getChildren() is never called. As you say, it's easy to burn a *lot* of time trying to track this down. I've modified my code to add children and label properties, but that hasn't helped yet. Any insights would be most appreciated!

              Ian