1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    9
    Vote Rating
    0
    chanceusc is on a distinguished road

      0  

    Default Getting started with ExtJS and having issues with Async Tree

    Getting started with ExtJS and having issues with Async Tree


    Hello all,

    I'm just getting started with ExtJS so I am a little confused. I pretty much did a straight copy and paste of the drag-and-drop tree example, I'm getting this:
    [{"id": "1","text": "child","leaf: True}]);

    as a successful response back from the server but all I am getting is a box with 1 list item (Ext JS)

    I would *greatly, greatly* appreciate any help here. Thanks in advance!

    Code:
    Ext.onReady(function(){
        // shorthand
        var Tree = Ext.tree;
        
        var tree = new Tree.TreePanel({
            el:'tree-div',
            useArrows:true,
            autoScroll:true,
            animate:true,
            enableDD:true,
            containerScroll: true, 
            loader: new Tree.TreeLoader({
            dataUrl:'Manage/Tree'
            })
        });
       var root = new Tree.AsyncTreeNode({
            text: 'Ext JS',
            draggable:false,
            id:'0'
        });
        tree.setRootNode(root);
    
        // render the tree
        tree.render();
        root.expand();
    });

  2. #2
    Ext User
    Join Date
    Apr 2008
    Posts
    9
    Vote Rating
    0
    chanceusc is on a distinguished road

      0  

    Default


    Here is the response from my server-side app (Asp.net MVC):
    Code:
    <head>
    <script src="../../Content/Scripts/ext-base.js" type="text/javascript"></script>
    <script src="/Content/Scripts/ext-all.js" type="text/javascript"></script>
    <script src="../../Content/Scripts/exttree.js" type="text/javascript"></script>
    
    </head>
    <div id="tree-div" style="overflow:auto; height:300px;width:250px;border:1px solid #c3daf9;"></div>
    
    </body></html>

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    9
    Vote Rating
    0
    chanceusc is on a distinguished road

      0  

    Default


    If I use the JSON that comes with the example, it seems to work - (I realize there was a misplaced quote in the first) but I really don't see how I am messing up.. I am using the JSON straight from the API :/ Again, any help would be greatly appreciated, thanks!

  4. #4
    Ext User
    Join Date
    Dec 2007
    Posts
    34
    Vote Rating
    0
    DhakouaniM is on a distinguished road

      0  

    Default


    I'd recommend you to look into the tree loader....
    What exactly are you trying to do ?

    Mehdi

  5. #5
    Ext User
    Join Date
    Apr 2008
    Posts
    9
    Vote Rating
    0
    chanceusc is on a distinguished road

      0  

    Default


    I have, thats where I got the API for the JSON from (well not what I posted exactly.. that was the result of trying to mimic the post-back of the example moreso than the API). All I am trying to do at the moment is simply pass back the children of the node and have them load.

Thread Participants: 1