refresh cause tree panel blank

  1. #1

    refresh cause tree panel blank

    Greeting ....

    I use this code to refresh my tree ..

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Barang.aspx.cs" Inherits="WebApplication1.Setup.Barang" %>
    <script runat="server">
    public string RefreshMenu()
        Ext.Net.NodeCollection nodes = this.BuildTree(null);
        return nodes.ToJson();
    <html xmlns="">
    <head runat="server">
            var refreshTree = function (tree) {
                    success: function (result) {
                        var nodes = eval(result);
                        if (nodes.length > 0) {
                        else {
    I get that code from Ext.Net example #/TreePanel/Basic/Refresh_Static_Tree/

    and build tree using Ext.Net example #/TreePanel/Loaders/Direct_Method/

    it look like

    Click image for larger version. 

Name:	treePanel_ada.png 
Views:	42 
Size:	82.8 KB 
ID:	25354

    but after refresh using that code above, my tree become like this

    Click image for larger version. 

Name:	treePanel_blank.png 
Views:	20 
Size:	25.9 KB 
ID:	25355

    is there any solution .... ???

    Thank's ....
    Last edited by fabricio.murta; May 29, 2020 at 3:53 PM. Reason: Add URLs to examples references.
  2. #2
    Hello @muhammadantoniussony!

    The two examples depict situations that are fairly "mutually exclusive". In one hand, you have a tree that loads on demand. In the other hand, you have a refresh loading the full tree.

    In order to attain a "refresh" behavior in an environment like a loader-based tree, you'd have to, instead of reloading everything, to remember which local nodes are expanded, unload everything and then reload from root to the point you were.

    One approach to get the behavior you want is:

    1. start by "unloading" the tree; so that when "refresh" is clicked, it returns to its initial state. So basically you reset the tree without a full page reload.
    2. Then you will have to save the expanded nodes somewhere else (an array, or a temporary store, you name it)
    3. traverse the list of expanded nodes, from root down, calling the corresponding node in the refreshed tree's .expand() method, and letting the direct method run (wait all the server trip -- your best bet is to bind the continuation of the process to the direct method's callback)
    4. if a expanded node is not found, then the process should stop (because it means the node was removed from the fresh version of the tree).

    So, basically, you have to reload and repeat the user steps to expand the tree.

    For performance, you can pass the list of expanded nodes to the refresh method and have it return the whole expanded tree.

    Using the approach from the first example you pointed (TreePanel > Basic > Refresh_Static_Tree) only supports bringing the whole tree, which is something you probably don't want -- after all you load just a level of the tree for a reason.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3


    Greeting ...

    I add .expand() method on code behind

                Ext.Net.Node root = new Ext.Net.Node();
                root.Text = "RooT";
                root.Expanded = true;  /* --- add this make root.children to show, cause it hide on RooT --- */
    Thank you ....

Similar Threads

  1. Replies: 1
    Last Post: Nov 05, 2017, 11:22 AM
  2. [CLOSED] Refresh Tree Panel
    By S.KARATHANASIS in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 17, 2013, 2:04 PM
  3. Replies: 11
    Last Post: Oct 07, 2011, 9:14 AM
  4. Replies: 8
    Last Post: May 28, 2009, 8:18 PM
  5. Replies: 3
    Last Post: Jan 03, 2009, 10:41 PM

Posting Permissions