[CLOSED] TreePanel rootVisible = false problem

  1. #1

    [CLOSED] TreePanel rootVisible = false problem

    Hi,

    I have a treepanel and I can load data to the treeopanel successfully.But
    I want to set rootVisible property of treepanel to false.When I set the rootVisible property to false,I am getting an error like Request Failure.Related screenshot is following.Despite the error, it works well.

    How to overcome this.

    Related code block is ;

    protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ConcreteDepartmentDefinition [] l = Department.GetDepartmentList();
    
                foreach (var obj in l)
                {
                    if (obj.DepartmentParentOid == null || obj.DepartmentParentOid == 0)
                    {
                        Node root = new Node();
                        root.NodeID = obj.Oid.ToString();
                        root.Text = "<b>"+obj.DepartmentCode+"</b> - "+obj.DepartmentName;
                        root.Icon = Icon.UserHome;
                        root.Leaf = obj.IsLeaf;
                        treePanel1.Root.Add(root);
                        treePanel1.RootVisible = false;
                    }
                    else
                    {
                        Node newNode = new Node();
                        newNode.NodeID = obj.Oid.ToString();
                        newNode.Text = "<b>"+obj.DepartmentCode+"</b> - "+obj.DepartmentName;
                        newNode.Icon = Icon.UserGreen;
                        newNode.Leaf = obj.IsLeaf;
                        treePanel1.GetNodeById(obj.DepartmentParentOid.ToString()).AppendChild(newNode);
                    }
                }
            }
    Attached Thumbnails Click image for larger version. 

Name:	treepanel2.png 
Views:	101 
Size:	5.3 KB 
ID:	24309   Click image for larger version. 

Name:	treepanel3.png 
Views:	109 
Size:	17.5 KB 
ID:	24310   Click image for larger version. 

Name:	treepanel4.png 
Views:	93 
Size:	13.0 KB 
ID:	24311  
    Last edited by Daniil; Nov 06, 2015 at 2:30 PM. Reason: [CLOSED]
  2. #2
    read this. if you are accessing a variable. set the autoload to false and load it in after render.

    http://forums.ext.net/showthread.php...t-find-App-YYY

    Thanks
    /Z
  3. #3
    Hi @Z,

    I read this.I think my problem is not related with yours,I have only a treepanel and I want to load this on pageLoad basicly.

    Thanks for reply,
  4. #4
    Is anybody has any idea?
  5. #5
    Hello @metci,

    This should be replaced with a different approach.
    treePanel1.GetNodeById(obj.DepartmentParentOid.ToString()).AppendChild(newNode);
    root.Children should be populated. As it is done here:
    https://examples2.ext.net/#/TreePane...h_Static_Tree/
    Last edited by Daniil; Nov 05, 2015 at 3:16 PM.
  6. #6
    Hi @Daniil,

    I am sorry,but i dont understand the relation between my problem and your suggestion.I think tree what you suggest dont meet my needs.There is no hierarhy on tree.Could you explain how to find parent of child and load it.Perhaps you could send a small sample.

    Normally before rootvisible is set to false,tree was working very well.After setting,it started to get request failure.

    I am wating your help.
  7. #7
    Normally before rootvisible is set to false,tree was working very well.After setting,it started to get request failure.
    Yes, but the GetNodeById() and AppendChild() methods should be avoided to be used during initial Page_Load. Those methods are quite designed for DirectEvents and DirectMethods.

    I am sorry,but i dont understand the relation between my problem and your suggestion.I think tree what you suggest dont meet my needs.There is no hierarhy on tree.Could you explain how to find parent of child and load it.
    You correctly do this:
    treePanel1.Root.Add(root);
    Then to add a child node to the root, you should do:
    treePanel1.Root.Children.Add(node);
    and so on.

    To find a Node by its id, you should recursively iterate nodes' .Children starting from the root.
  8. #8
    Hi @Daniil,
    To find a Node by its id, you should recursively iterate nodes' .Children starting from the root.
    Recursively iterate action is not clear on my mind.Could you please can you send a small sample.

    Thanks for advance,
  9. #9
    Hi @Daniil

    Eventually it worked very well by using your technique.

    Thank you very much.

Similar Threads

  1. [CLOSED] [#600] TreePanel's AutoLoad set to false
    By RCN in forum 3.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 14, 2015, 12:20 PM
  2. Replies: 1
    Last Post: Nov 26, 2012, 4:49 PM
  3. [CLOSED] [1.3] Problem with rootVisible on TreePanel
    By John_Writers in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Apr 02, 2012, 7:46 AM
  4. [CLOSED] TreePanel RootVisible
    By pdcase in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 29, 2010, 9:12 PM
  5. [CLOSED] TreePanel RootVisible Question
    By UGRev in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 27, 2009, 1:59 PM

Tags for this Thread

Posting Permissions