[CLOSED] TreePanel question

  1. #1

    [CLOSED] TreePanel question

    Hi
    I am trying to do the following

    Say I have list with Parent and children. all Parents have level of 1 and children have level 2, 3 and so on
    I would like to create tree with top level under root expanded using TreeNode and then when clik on parent use AsyncTreeNode. It seems that I can do it if top level are not expanded and using AsyncTreeNode for all levels per some of the examples.

    is it possible to do as per my example.
    thanks
    idriss
  2. #2

    RE: [CLOSED] TreePanel question

    Hi,

    Do you need the following functionality or something else?
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" 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 id="Head1" runat="server">
        <title></title>
        
        <script runat="server">
            protected void NodeLoad(object sender, NodeLoadEventArgs e)
            {
                if (!string.IsNullOrEmpty(e.NodeID))
                {
                    for (int i = 1; i < 6; i++)
                    {
                        AsyncTreeNode asyncNode = new AsyncTreeNode();
                        asyncNode.Text = e.NodeID + i;
                        asyncNode.NodeID = e.NodeID + i;
                        e.Nodes.Add(asyncNode);
                    }
    
                    for (int i = 6; i < 11; i++)
                    {
                        Coolite.Ext.Web.TreeNode treeNode = new Coolite.Ext.Web.TreeNode();
                        treeNode.Text = e.NodeID + i;
                        treeNode.NodeID = e.NodeID + i;
                        treeNode.Leaf = true;
                        e.Nodes.Add(treeNode);
                    }
                }
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />         
            
            <ext:TreePanel ID="TreePanel1" runat="server" Width="300" Height="450" Title="Tree" AutoScroll="true">
                <Root>
                    <ext:TreeNode NodeID="root" Text="Root">
                        <Nodes>
                            <ext:AsyncTreeNode NodeID="Beethoven" Text="Beethoven" Icon="UserGray" />
                            <ext:AsyncTreeNode NodeID="Brahms" Text="Brahms" Icon="UserGray" />
                            <ext:AsyncTreeNode NodeID="Mozart" Text="Mozart" Icon="UserGray" />
                        </Nodes>
                    </ext:TreeNode>
                </Root> 
                
                <Loader>
                    <ext:PageTreeLoader OnNodeLoad="NodeLoad" />
                </Loader>          
            </ext:TreePanel>
        </form>
    </body>
    </html>
  3. #3

    RE: [CLOSED] TreePanel question

    thank you vlad. it is working.

Similar Threads

  1. Very simple question TreePanel check or uncheck all
    By apocalipse9 in forum 1.x Help
    Replies: 0
    Last Post: Jun 17, 2010, 12:36 AM
  2. [CLOSED] Question about effective TreePanel Programming
    By ljankowski in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jan 25, 2010, 1:32 PM
  3. Excuse Me ,another question about treepanel
    By Fabrizio in forum 1.x Help
    Replies: 2
    Last Post: Dec 18, 2009, 6:40 PM
  4. [CLOSED] TreePanel RootVisible Question
    By UGRev in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 27, 2009, 1:59 PM

Posting Permissions