Refresh tree item and all his childs

I’m creating a tree using the script:

tree.loadXMLString(res,function(){tree.loadOpenStates()});



Later in the server I’m updating specific branch, and want the tree to refresh only this branch.

I’m using the method:



tree.refreshItem(parentId,sRes);



Where parentId is: 3823276648

And sRes is:









The parent node is refresh but all his childs disapear.

Should I use diffrent method.



My dhtmlXtree version is: dhtmlxTree_pro_v16_71114



Thanks


refreshItem method can be used only with dynamic loading. And it doesn’t have the 2nd parameter.


You can use either refreshItems method to update ceratin items or smartRefreshBranch to refresh the whole branch:


tree.refreshItems(parentId,sRes);


tree.smartRefreshBranch(parentId,sRes);


This doesn’t work,



1. tree.refreshItems(parentId,sRes);  - refresh only the parent node and not the children, I can see it also in your supplied samples.



2. tree.smartRefreshBranch(parentId,sRes); - returns the following error: error load XML



I’m passing the String:









as the second argument, should I call servlet that will return the string?




 



 


The second parameter of the smartRefreshBranch and refreshItems method is path server-side script that returns the necessary xml:


for example:


tree.smartRefreshBranch(parentId,some_script+"?id="+parentId);


The example of the xml:


<tree id=“382327664”>













Thanks, the solution wokred