Removing one child causes removing of all chidlren

Hi,



We encountered a problem with removing child. Our tree is at left and it works with content at right side. We use setXMLAutoLoading to do auto loading. When we delete an object /child from right side, we use smartRefreshBranch to refresh the parent node. Our problem is:



There were orginally two children under this parent node. After one child was deleted, backend servlet returned correct xml which indicated that this parent has children. But the tree showed no child at all under it. We cannot figure out why.



Thank you.



Yingle


Hello,


smartRefreshBranch loads the whole branch from server and item that are not presented in xml are removed.


You can try to use refreshItem(itemId) instead of it. In this case the refreshed item is loaded dynamically ( xml defined in setXMLAutoLoading is loaded for this item).


The sample is dhtmlx.com/docs/products/dhtmlxT … fresh.html


I’m truly sorry. My description of the problem is not correct. The tree structure is:



P1



  P2



    C1



    C2



P2 is P1’s child. C1 and C2 are P2’s children. When we remove C1, we do smartRefreshBranch on P1 because there may be other related objects removed under P1 with C1. We checked the xml returned from servlet, it indicates correctly that P2 still has child(ren). But tree shows P2 without any child under it. If we use smartFreshItem on P1, C1 won’t be removed from the tree.



Thanks.


Hello,


smartRefreshBranch requires that all nodes of the branch are in the xml (child=“1” doesn’t effect tree in this case).


If you want to reload P1 branch, smartRefreshBranch(“P1_id”,xml) should load the following xml:












If you want to use child=“1” attribute, you can use refreshItem(“P1_id” ) method. In this case script defined in setXMLAutoLoading will be called for “P1_id”.


Thank you. I saw two “p1_id” in your xml though. Just to clarify, you meant p2_id in the following statement, right?



If you want to use child=“1” attribute, you can use refreshItem(“P1_id” ) method. In this case script defined in setXMLAutoLoading will be called for “P1_id”.



 


Yes, sorry for the misleading information. I meant p2_id:






And here “If you want to use child=“1” attribute, you can use refreshItem(“P2_id” ) method. In this case script defined in setXMLAutoLoading will be called for “P2_id”.”







Hi Alex,



One more question: in your previous post, you mentioned -



smartRefreshBranch requires that all nodes of the branch are in the xml (child=“1” doesn’t effect tree in this case). 



What we observed is that when a tree structure is:



P1



   P2



       C1



       C2



Originally, P2 had a plus sign since it had children C1 and C2. After we removed C2, we freshed node P1. P2 somehow lost the child C1 and its plus sign even though xml returned from servlet states that P2’s child attribute is 1. Why tree in this case decides to remove P2’s plus sign and child?



Thanks.



 


Hello,


there is the same situation as in the P2’s case. The xml for P1 branch should be (all nodes should be here):