1. #1
    Ext User
    Join Date
    Mar 2009
    Posts
    16
    Vote Rating
    0
    Puzo is on a distinguished road

      0  

    Default Change SET root Node

    Change SET root Node


    Hello,

    I have problems with Setting new ROOT node in Tree menu. How can I remove this Root Node, so the tree will start with other root node (datas from MySQL) ?

    Here is code:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>ExtJsLayout</title>
        <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
        <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="../../ext-all-debug.js"></script>
        <script type="text/javascript">
    Ext.onReady(function() {
        // Define Tree.
        var Tree_Category_Loader = new Ext.tree.TreeLoader({
            dataUrl   :"_class4.php"
        });
        var Tree_Category = new Ext.tree.TreePanel({
            title            : 'My Category Tree',
            collapsible      : false,
            animCollapse     : false,
            border           : true,
            id               : "tree_projectcategory",
            el               : "tree_projectcategory",
            autoScroll       : true,
            animate          : false,
            enableDD         : true,
            containerScroll  : true,
            height           : 100,
            width            : 300,
            loader           : Tree_Category_Loader
        });
     
        // SET the root node.
        var Tree_Category_Root = new Ext.tree.AsyncTreeNode({
            text        : 'My Root Node',
            draggable    : false,
            id        : '0'                  // this IS the id of the startnode
        });
     
        // Render the tree.
        Tree_Category.setRootNode(Tree_Category_Root);
        Tree_Category.render();
        Tree_Category_Root.expand();
    });                        
    </script>
    </head>
    <body>
    <div id="tree_projectcategory" ></div>
    </body>
    </html>

  2. #2
    Ext User
    Join Date
    Mar 2007
    Posts
    52
    Vote Rating
    2
    exo is on a distinguished road

      0  

    Default


    Set rootVisible: false on the treepanel?

  3. #3
    Ext User
    Join Date
    Mar 2009
    Posts
    16
    Vote Rating
    0
    Puzo is on a distinguished road

      0  

    Default


    Thanks for the advice, now its working!

Thread Participants: 1