1 Reply Latest reply on Feb 11, 2009 2:35 PM by Newsgroup_User

    Loading tree data lazily?

    wt.ustc
      I have a tree to display some ejb3 entities; the entities are related to each other in a tree hierarchy. I implement ITreeDataDescriptor to load the entities into the tree, which works fine. However, when I try to expand a branch node, I got an error "PersistenceCollection initializing", because the collections are marked to load lazily. So I need to do the following in sequence:

      1. Intercept the branch opening event; (I can do this by listening for itemOpening)
      2. Find out which item is being opened;
      3. Load the collection for that item;
      4. Wait till the collection finishes loading, then continue with the branch open;

      I can figure out how to do steps 1 and 3, but have no idea how 2 and 4 could be done. I appreciate if someone could shed a light on this.
        • 1. Re: Loading tree data lazily?
          Level 7

          "wt.ustc" <webforumsuser@macromedia.com> wrote in message
          news:gmva76$2mq$1@forums.macromedia.com...
          >I have a tree to display some ejb3 entities; the entities are related to
          >each
          > other in a tree hierarchy. I implement ITreeDataDescriptor to load the
          > entities
          > into the tree, which works fine. However, when I try to expand a branch
          > node, I
          > got an error "PersistenceCollection initializing", because the collections
          > are
          > marked to load lazily. So I need to do the following in sequence:
          >
          > 1. Intercept the branch opening event; (I can do this by listening for
          > itemOpening)
          > 2. Find out which item is being opened;
          > 3. Load the collection for that item;
          > 4. Wait till the collection finishes loading, then continue with the
          > branch
          > open;
          >
          > I can figure out how to do steps 1 and 3, but have no idea how 2 and 4
          > could
          > be done. I appreciate if someone could shed a light on this.

          This might help:
          http://flexdiary.blogspot.com/2009/01/lazy-loading-tree-example-file-posted.html