[CLOSED] TreePanel Refresh server side

  1. #1

    [CLOSED] TreePanel Refresh server side

    Hi,
    I'm building a page to filter a treepanel server side.

    Clicking on a button server side, I populate the tree with the following code:

    
    //remove old nodes
                TreeFunctional.Root.Clear();
    
                var q = from myrow in dt.AsEnumerable()
                        where !myrow.Field<int?>("ID_INV_REGISTRY_PARENT").HasValue
                        select 
                            new
                            {
                                Description = myrow.Field<string>("Description")
                            ,   ID_INV_REGISTRY = myrow.Field<int?>("ID_INV_REGISTRY")
                            };
    //load new nodes in the tree
                foreach (var r in q)
                {
                    Ext.Net.Node root = new Ext.Net.Node()
                    {
                        Text = r.Description
                    };
    
    
                    root.CustomAttributes.Add(new ConfigItem("ID_INV_REGISTRY", Convert.ToString(r.ID_INV_REGISTRY)));
    
    
                    root.Children.AddRange(GetFunctionalChildNodes(dt, r.ID_INV_REGISTRY.Value));
    
    
                    root.Expandable = root.Expanded = (root.Children.Count > 0);
    
    
                    TreeFunctional.Root.Add(root);
                }
    //render the content of the tree
                TreeFunctional.Render();
    The treepanel is inside an accordion panel.

    After I run this code, the treepanel stay clear without nodes, if I collapse and expand the treepanel inside the accordion panel, then I can see all the nodes in the tree.

    I used the TreeFunctional.Render() method to render the treepanel after I populate it, but it seems to be not enough, so what method should I use to refresh the tree?

    Thank you for your help.

    Have a good day.
    Last edited by Daniil; Feb 12, 2014 at 1:27 PM. Reason: [CLOSED]
  2. #2
    Hi @John_Writers,

    I cannot reproduce with this sample.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Refresh(object sender, DirectEventArgs e)
        {
            this.TreePanel1.Root.Clear();
            this.TreePanel1.Root.Add(new Node()
            {
                Text = "Root " + DateTime.Now.Second,
                Children =
                {
                    new Node()
                    {
                        Text = "Child " + DateTime.Now.Second,
                        Leaf = true
                    }
                }
    
            });
            this.TreePanel1.Render();
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:Button runat="server" Text="Refresh" OnDirectClick="Refresh" />
    
            <ext:Panel 
                ID="Panel1"
                runat="server" 
                Width="300" 
                Height="400" 
                Layout="AccordionLayout">
                <Items>
                    <ext:TreePanel ID="TreePanel1" runat="server">
                        <Root>
                            <ext:Node Text="Initial Root">
                                <Children>
                                    <ext:Node Text="Initial Child" Leaf="true" />
                                </Children>
                            </ext:Node>
                        </Root>
                    </ext:TreePanel>
                </Items>
            </ext:Panel>                
        </form>
    </body>
    </html>
  3. #3
    Hum,
    is quite the same I did..

    Anyway, I solved calling the Render Method on the parent panel with accordion layout..

    Thank you for your time!

    Have a good day!

Similar Threads

  1. [CLOSED] Refresh gridpanel server side
    By PriceRightHTML5team in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 05, 2013, 12:27 PM
  2. [CLOSED] Refresh TreePanel Server Side
    By Antonio09 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 17, 2012, 5:00 PM
  3. How can i refresh the Treepanel in server side
    By NishaLijo in forum 1.x Help
    Replies: 7
    Last Post: Jan 18, 2012, 10:00 PM
  4. Refresh treepanel from server side after event
    By MikeWallaroo in forum 1.x Help
    Replies: 3
    Last Post: Nov 28, 2011, 9:43 AM
  5. Replies: 1
    Last Post: May 13, 2009, 12:14 PM

Posting Permissions