[CLOSED] TreePanel Refresh Tree

  1. #1

    [CLOSED] TreePanel Refresh Tree

    Hi,

    I've a TreePanel wherein I use a toolbar button to add nodes (Folders) to the selected node.

    Its using an AjaxProxy to populate the nodes.

    When the toolbar button is clicked to add new folder, a popup window opens where I can enter a name for the new folder(node value).
    Now, how can I refresh the node/treepanel after I add the node value from the popup window (either after the InsertNode code behind function fires or when the popup window is closed).

    If you can please provide both javascript and C# code.

    Thanks
    Last edited by Daniil; May 30, 2015 at 2:25 PM. Reason: [CLOSED]
  2. #2
    Hi @webpresence,

    Sorry, I don't quite understand what exactly you need to refresh.

    You add a new folder node and need to expand it? Expanding should initiate a load request with AjaxProxy.
    node.expand();
    Maybe, it is what you are asking.
  3. #3

    TreePanel Refresh Tree

    Hi,

    I'm just adding a folder to the folder structure - the treepanel is showing the folder structure.

    I select a node from the TreePanel (which is a folder name within the folder structure) and then adds a folder in the folder structure (not adding a node to the tree directly).

    Now, after creating this new folder I want to refresh the node so that it lists the newly added folder in the folder structure.

    Thanks
  4. #4
    Ok, to reload a specific node please use:
    tree.getStore().reload({
        node: the_node_that_you_need_to_reload
    });
  5. #5

    TreePanel Refresh Tree

    Thanks for the solution.

    But, I've one issue now - When I add folder names to the TreePanel, if the folder has no subfolders, I set the Leaf attribute to True.

    Now, after implementing your solution, reload works fine if the Node is not a Leaf node - how can I get it working for a leaf node?
    Even if I set the Leaf attribute to false (from JavaScript), only the associated icon changes and not showing the added folder(node).

    Thanks
  6. #6
    For leaf nodes please use:
    node.set("leaf", false);
    node.expand();
  7. #7

    TreePanel Refresh Tree

    Hi Daniil,

    Thanks for your suggestion and it works to some extent!

    The issue now is, though the node is now expanded and it shows the newly added folder underneath, when I click on the "-" sign along the folder(node), though the icon changes to "+" the subfolder (node) remains as is - its not collapsing/expanding - any help on this would be much appreciated.

    Thanks
  8. #8
    I cannot reproduce it with this example:
    https://examples3.ext.net/Examples/T.../Using_Handler

    The steps:

    1. Expand the root.

    2. Run this in a browser's JavaScript console.
    var node = App.TreePanel1.getStore().getNodeById("06");
    
    node.set("leaf", false);
    node.expand();
    3. Click on the "06" node's minus icon.

    4. It gets collapsed.

    5. A subsequent click on the node's plus icon expands it.

Similar Threads

  1. [CLOSED] Refresh Tree Panel
    By S.KARATHANASIS in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 17, 2013, 2:04 PM
  2. [CLOSED] TreePanel refresh tree node
    By boris in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 16, 2011, 10:32 AM
  3. Replies: 2
    Last Post: Jul 30, 2010, 12:37 AM
  4. Replies: 0
    Last Post: Jan 01, 2010, 6:50 AM
  5. How to refresh tree using CodeBehind and VB?
    By dbassett74 in forum 1.x Help
    Replies: 0
    Last Post: Apr 21, 2009, 2:47 PM

Tags for this Thread

Posting Permissions