Results 1 to 2 of 2

Thread: How to load EXT tree in version 3.2

  1. #1

    Default How to load EXT tree in version 3.2

    Hello all
    I am using EXT 3.2 for loading tree . The overall code is as follows.

    Code:
    
    
    Code:
    
                     var treePanel = new Ext.tree.TreePanel({ 				       useArrows : true, 				       autoScroll: true, 				       animate: true, 				       enableDD: true, 				       containerScroll: true, 				      rootVisible : false, 				      loader: new Ext.tree.TreeLoader({ 				    	  dataUrl: 'data.jsp?tree', 				    	 preloadChildren: true, 				          requestMethod: 'GET' 				       }), 				      root: { 				         nodeType: 'async', 				         text: 'Ext JS', 				          expanded : true, 				         draggable: false, 				         id: 'treeModel' 				     }  				});
    
    


    Though in this case my JSON is having some custom root. The JSON structure is as follows


    Code:
    
    
    Code:
    {"treeModel":[{"id":"Node1","text":"Node 1","leaf":false},{"id":"Node2","text":"Node 2","leaf":false},{"id":"Node4","text":"Node 4","leaf":false}]}


    Here I have root as "treeModel" and there is no way I can change this. My tree may be not understanding what is the root because of which tree is not getting rendered. Is there any way I can specify root for my tree ? Is there anything like "reader" for tree ? If it is there can anyone please tell me how to use it.
    Thanks in advance
    Samir



  2. #2
    Sencha User poojagarg89's Avatar
    Join Date
    Sep 2011
    Location
    Ahmedabad,India
    Posts
    213

    Default

    try this Code may be it'll be of ur help...........!!!
    Code:
    var  admin_root= new Ext.tree.TreeNode({
                id:"admin_node",
                text:"Admin",
                expanded:true
        });    
    
    Ext.app.widgetsLoader = Ext.extend(Ext.ux.XmlTreeLoader, {
        processAttributes : function(attr){
        if(attr.widget_id){ 
                 attr.text = attr.widget_id;
                 attr.loaded = true;
                }
        }
    });
        var widgets_typeLoader =new Ext.app.widgetsLoader({
                    id:"widgetconf_typeLoader",
                     dataUrl:'WidgetConfiguration_Tree'
         });     
        widgets_root=admin_root.appendChild(
          new Ext.tree.AsyncTreeNode({
                 text:'Widget Configuration',
                // id:'permissions_node',
                 scope:this,
                 loader:widgets_typeLoader
           })
        );
        
    var admin_panel = new Ext.tree.TreePanel({
        id: "admin_panel",
       // useArrows: true,
        autoScroll: true,
        title: "",
        border:false,
        collapsible: false,
        autoScroll: true,
        rootVisible: true,
        lines: true,
        singleExpand:true,
        root:admin_root,
        listeners:{
            click:function(node,e)
            {}
    }
    });

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •