Refresh Entire Tree

I have a tree control that has extensive nodes changes in use and effectively requires a total refresh after each operation. Refreshing a single node isn’t enough, because of index issues, etc.

This is the XML I use to load the tree:

<?xml version="1.0" encoding="utf-8" ?> <tree id="0"> <item id="a:1" text="App1" type="application"> <item id="e0:2" type="environment" text="Development"> <item id="h0:1884" type="host" text="HostE" /> <item id="h1:1372" type="host" text="HostF" /> </item> <item id="e6:1" type="environment" text="Production"> <item id="h6:9003" type="host" text="HostA" /> <item id="h7:8253" type="host" text="HostB" /> <item id="h8:7338" type="host" text="HostC" /> <item id="h9:8010" type="host" text="HostD" /> </item> </item> <item id="a:2" text="App2" type="application"> <item id="e10:2" type="environment" text="Development"> <item id="h10:9169" type="host" text="HostI" /> </item> <item id="e11:1" type="environment" text="Production"> <item id="h11:4560" type="host" text="HostG" /> <item id="h12:8950" type="host" text="HostH" /> </item> </item> </tree>

Is there a command I can use to force a full refresh?

It looks like this works.

myTree.deleteChildItems(0);
myTree.loadXML("/tree/");

If you are using PRO edition, it would be better to use smartRefreshBranch method:

tree.smartRefreshBranch(0,"/tree/");

In this case open states will be preserved.