1. #1
    Ext User
    Join Date
    May 2009
    Posts
    56
    Vote Rating
    -1
    GoneIn20Seconds is an unknown quantity at this point

      0  

    Question Is it possible to load a Tree without call to server

    Is it possible to load a Tree without call to server


    Is it possible to load a tree without a call to the server? If so, how is it done?

    For example, say I have a JSON object stored already in a Javascript variable. I want to take that object and tell the tree to load it's nodes from that object.

    The object is currently structured in such a way that it is identical to the object that would be returned from the server to load that same tree.

  2. #2
    Ext User
    Join Date
    May 2009
    Posts
    56
    Vote Rating
    -1
    GoneIn20Seconds is an unknown quantity at this point

      0  

    Smile Solved

    Solved


    I figured this out.

    Instead of using the tree loader I had to manually add tree nodes. Because the JSON object I have stored the data into already represented the structure to be used by the TreeLoader, I did the following:

    Code:
    Ext.getCmp("componentId").setRootNode(getNodeFromJsonObject(jsonObject));
    
    function getNodeFromJsonObject(object) {
        var node;
        var child;
        var i;
        
        node = new Ext.tree.TreeNode({
            id: object.id,
            expanded: object.expanded,
            iconCls: object.iconCls,
            text: object.text
        });
        
        if (typeof(object.children) != "undefined") {
            for (i = 0; i < object.children.length; i++) {
                child = getNodeFromJsonObject(object.children[i]);
                node.appendChild(child);
            }
        }
        
        return node;
    }

  3. #3
    Sencha User
    Join Date
    May 2008
    Location
    Porto, Portugal
    Posts
    38
    Vote Rating
    0
    woozy is on a distinguished road

      0  

  4. #4
    Ext User
    Join Date
    May 2009
    Posts
    56
    Vote Rating
    -1
    GoneIn20Seconds is an unknown quantity at this point

      0  

    Default Did I miss something?

    Did I miss something?


    It's a very big API and I've definitely been reading it. Is there something I missed?

  5. #5
    Sencha User
    Join Date
    May 2008
    Location
    Porto, Portugal
    Posts
    38
    Vote Rating
    0
    woozy is on a distinguished road

      0  

    Default


    No. I hadn't seen your second post when I reply.
    ___________
    Sérgio Serra

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar