Results 1 to 3 of 3

Thread: How to make the AsyncTreeNode expand all the node

  1. #1
    Ext User
    Join Date
    Jul 2008
    Posts
    50

    Default How to make the AsyncTreeNode expand all the node

    How to make the AsyncTreeNode expand all the node?i called root.expandChildNodes(true);,but it didnot work.

    Code:
    var Tree = Ext.tree;
    var root = new Tree.AsyncTreeNode({
     text : paraMenuName,
     draggable : false,
     expanded :true,
     id : 'root',
     loader : new Tree.TreeLoader({
      dataUrl : menuUrl
     })
    });
    var tree = new Ext.tree.TreePanel({
     contentEl : 'west',
     border : true,
     root : root,
     region : 'west',
     id : 'west-panel',
     split : true,
     width : 160,
     minSize : 150,
     maxSize : 200,
     margins : '0 0 0 0',
     layout : 'accordion',
     title : paraMenuName,
     collapsible : true,
     layoutConfig : {
      animate : true
     },
     rootVisible : true,
     autoScroll : true
    });
    tree.on('click', treeClick);
    var tab = new Ext.TabPanel({
     region : 'center',
     xtype: 'tabpanel',
     id:'tabcontent',
     resizeTabs:true, 
     deferredRender : false,
     activeTab : 0,
     minTabWidth: 100,
     tabWidth:150,
     enableTabScroll:true,
     plugins: new Ext.ux.TabCloseMenu(),
        defaultType:"iframepanel",
     items : [{
      contentEl : 'contenPanel',
      title : menuName,
      autoScroll : true,
      id : resid,
      iconCls:'tabs',
      closable : false,
      defaultSrc : FirstmenuURL,
            frameConfig: {  id:'myFrame', name:'myFrame', frameborder:0}
     }]
    });
    //tab.setIconClass('tabs');
    function treeClick(node, e) {
     if (node.isLeaf()) {
      e.stopEvent();
      var n = tab.getComponent(node.id);
      if (!n && node.id != resid) {
       n = tab.add(new Ext.ux.ManagedIframePanel({
        id : node.id,
        title : node.text,
        closable : true,
        iconCls:'tabs',
        autoScroll : true,
        frameConfig: {  id:node.id+'frame', name:node.id+'frame', frameborder:0},
        defaultSrc:node.attributes.href
       }));
       //n.setIconClass('new-tab');
      }
      tab.setActiveTab(n);
     }
    }
    var headerPanel = new Ext.BoxComponent({
     region : 'north',
     el : 'north',
     margins : '0 0 3px 0',
     height : 77
    });
    
    Ext.onReady(function() {
     var viewport = new Ext.Viewport({
      layout : 'border',
      items : [headerPanel, tree, tab]
     });
     viewport.doLayout();
     tree.render();
     root.expandChildNodes(true);
     loadend();
    });

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    Shouldn't that be:

    Code:
    root.expand(true);
    ps. Remember that expand() is asynchronous.

  3. #3
    Ext User
    Join Date
    Jul 2008
    Posts
    50

    Default

    Condor,if the root contains a node that contains a childnode, then the childnode cannot expend auto,i donot why?

Posting Permissions

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