Gautam:

Thanks for replying and sharing your knowledge.  I understood most of what
you shared, but I could never get my example working.  Do you have a
runnable example?  Maybe one that just randomly generated children instead
of having to go back to the database?  Once I see how it works, I can add
the call back to the database.

Like Jim, that will be my next hill to conquer.  How to handle data that's
returned when I'm not exactly sure who requested it (if the user clicks on
another item before data is returned)

THANKS GAUTAM!



On 17 Apr 2007 19:26:00 -0700, Gautam <[EMAIL PROTECTED]> wrote:

  hi,
hope this helps:

<mx:Tree id="treeSiteList" width="100%" height="78%"
dataProvider="{acSiteTreeList}" iconFunction="myTreeIcon"
itemOpen="setView(event)"/>

private function setView(event:TreeEvent):void {
                if(event.item.type == "something" && event.item.fetch ==
false) {
                    myEvent = event; //(myEvent is of type TreeEvent)
                    //update the dataprovider
                    var obj:ObjectProxy;
                var item:Object;
                var children:ArrayCollection;
                for(var i:int = 0; i < acSomething.length; i++) {
                    obj= new ObjectProxy();
                    obj["type"] = "something";
                    obj["children"] = new ArrayCollection();
                    obj["fetch"] = false;
                    item = myEvent.item;
                    children = item.children;
                    item.fetch = true;
                    children.addItem(obj);
                     acSiteTreeList.itemUpdated(item);
                }

                }
            }

fetch is a property i have used in the dataprovider to tell me if I have
fetched the child nodes previously or not...

[Embed(source="../assets/someIcon.png")]
                 private var reqdIconClass:Class;

private function myTreeIcon(item:Object):Class {
                if(item.type == "something") {
                   return reqdIconClass;
                }else {
                    return null;
                }

            }


Regards,
Gautam.


On 3/31/07, Justin Makeig <[EMAIL PROTECTED]> wrote:
>
>   Does anyone know of a public Flex 2 implementation of a lazy-loaded
> tree that I could
> reference (e.g. loading children dynamically from the server upon
> expanding a node)? From
> my searching I've seen a lot of dead ends and frustration, but no solid
> examples. I'd hate to
> (clumsily) reinvent the wheel. Any help would be much appreciated.
>
> Justin
>
>


Reply via email to