[CLOSED] Is there any example to create a new subtree below the selected node subtree with all the node of the subtree

  1. #1

    [CLOSED] Is there any example to create a new subtree below the selected node subtree with all the node of the subtree

    Hi

    I want to create a new subtree below the selected node subtree with all the node of the subtree ie,

    Shelf1
    --Row1
    ----Bin1
    ----Bin2
    --Row2
    ----Bin1
    ----Bin2

    IF i say some thing as CreateHeirarchy(Row1) then i should get

    Shelf1
    --Row1
    ----Bin1
    ----Bin2
    --Row2
    ----Bin1
    ----Bin2
    --Row3
    ----Bin1
    ----Bin2

    I hope u can understand my question.

    Thank you
    Last edited by Daniil; Sep 22, 2011 at 7:31 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Here you are.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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 runat="server">
        <title>Ext.Net Example</title>
    
        <script type="text/javascript">
            var addSubtree = function (tree) {
                var root = tree.getRootNode(),
                    index = root.childNodes.length + 1,
                    row = new Ext.tree.TreeNode({
                              text : "Row" + index,
                              expanded : true
                          }),
                    childs = root.childNodes[0].childNodes,
                    i,
                    clones = [];
    
                for (i = 0; i < childs.length;  i++) {
                    clones.push(childs[i].clone());    
                }
                row.appendChild(clones);
                root.appendChild(row);
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:TreePanel 
                ID="TreePanel1" 
                runat="server" 
                AutoHeight="true" 
                RootVisible="true">
                <Root>
                    <ext:TreeNode Text="Root" Expanded="true">
                        <Nodes>
                            <ext:TreeNode Text="Row1" Expanded="true">
                                <Nodes>
                                    <ext:TreeNode Text="Bin1" />
                                    <ext:TreeNode Text="Bin2" />
                                </Nodes>
                            </ext:TreeNode>
                        </Nodes>
                    </ext:TreeNode>
                </Root>
            </ext:TreePanel>
            <ext:Button runat="server" Text="Add a subtree">
                <Listeners>
                    <Click Handler="addSubtree(TreePanel1);" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
  3. #3
    Thank You... Daniil

Similar Threads

  1. Replies: 16
    Last Post: Jul 19, 2011, 3:53 AM
  2. [CLOSED] Remote-Load of a Subtree without expanding nodes
    By macap in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 31, 2011, 11:59 AM
  3. Replies: 1
    Last Post: Nov 24, 2010, 3:04 PM
  4. Replies: 1
    Last Post: Nov 17, 2010, 12:42 PM
  5. Replies: 1
    Last Post: May 04, 2010, 9:54 AM

Posting Permissions