[CLOSED] Treepanel dynamic loading with autoexpand

  1. #1

    [CLOSED] Treepanel dynamic loading with autoexpand

    Hi,

    I have a treepanel that loads root node and autoexpand these nodes calling server for its childs.

    But in v2.1 I'm having an internal error that I can't solve.

    This is the test case to try it:

    CONTROLLER
    public ActionResult TreeList()
            {
                Ext.Net.NodeCollection nodeCollection = new Ext.Net.NodeCollection();
    
                var id = Convert.ToInt32(Request["node"]);
                if (id == 0)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        Ext.Net.Node parentNode = new Ext.Net.Node
                        {
                            NodeID = i.ToString(),
                            Text = string.Format(HttpUtility.HtmlEncode("[Parent] Text Node {0}"), i),
                            Leaf = false,
                            Expandable = true,
                            Qtip = string.Format(HttpUtility.HtmlEncode("[Parent] Tooltip node {0}"), i),
                            Expanded = true
                        };
                        nodeCollection.Add(parentNode);
                    }
                }
                else
                {
                    for (int j = 0; j < 10; j++)
                    {
                        Ext.Net.Node childNode = new Ext.Net.Node
                        {
                            NodeID = string.Format("{0}.{1}", id, j),
                            Text = string.Format(HttpUtility.HtmlEncode("[Child] Text Node {0}.{1}"), id, j),
                            Leaf = true,
                            Expandable = false,
                            Qtip = string.Format(HttpUtility.HtmlEncode("[Child] Tooltip node {0}.{1}"), id, j),
                            Expanded = false
                        };
    
                        nodeCollection.Add(childNode);
                    }
                }
    
                return Content(nodeCollection.ToJson());
            }
    ASPX
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:TreePanel ID="treePanelListados" runat="server" Layout="FitLayout" Border="false"
            RootVisible="false" AutoScroll="true">
            <View>
                <ext:TreeView runat="server" LoadingUseMsg="false" LoadMask="false" TrackOver="true" />
            </View>
            <Store>
                <ext:TreeStore runat="server">
                    <Proxy>
                        <ext:AjaxProxy Url="/Area/Controller/TreeList" />
                    </Proxy>
                </ext:TreeStore>
            </Store>
            <Root>
                <ext:Node NodeID="0" />
            </Root>
        </ext:TreePanel>
    </body>
    </html>
    Last edited by Daniil; Sep 07, 2012 at 1:58 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Thank you for the report. We are investigating.

    P.S. Also thank you that you always provide us with excellent samples which we can run without any changes from our side. We much appreciate it!
  3. #3
    There are two nodes with the same id "0": the Root and the first one here:
    for (int i = 0; i < 5; i++)
    {
        Ext.Net.Node parentNode = new Ext.Net.Node
        {
            NodeID = i.ToString(),
    The ids must be unique.

    If you would replace
    for (int i = 0; i < 5; i++)
    with
    for (int i = 1; i < 6; i++)
    it will work fine.
  4. #4
    Yes, in my project I load root with Node=0, first level from a table and childs from another table. And like you say id's are duplicate.

    I solved it naming nodes with a composed key an getting this key in controller.

    Well, thanks for all.

Similar Threads

  1. [CLOSED] RowExpander autoexpand first row
    By bakardi in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 02, 2012, 2:58 PM
  2. Dynamic Control Loading
    By dtamils in forum 1.x Help
    Replies: 2
    Last Post: Aug 11, 2011, 7:17 AM
  3. [CLOSED] Loading TreePanel in MVC
    By webppl in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Feb 21, 2011, 10:10 PM
  4. AUTOEXPAND ALL COLUMNS ON A GRIDPANEL
    By marcmvc in forum 1.x Help
    Replies: 2
    Last Post: Oct 14, 2009, 5:14 PM
  5. Possible Bug in dynamic loading
    By Dave.Sanders in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 17, 2008, 5:14 PM

Tags for this Thread

Posting Permissions