Recreating the parent node manually throws error

Hi,

I had created a 2 sample tree. I want to move the nodes from one tree to another and vice versa. But, the following rules should be satisfied.

Rules:

  1. Only tree to tree drag-n-drop should be allowed.
  2. The child from one tree can be dragged to another tree under the same parent as in source tree, not under other parents.
  3. If we drag a child from one tree to another, and the another tree doesn’t have the parent of that particular node, then first the parent node should get created first and then the child should get added.
  4. If we again drag all other childs of the same parent from the source tree by dragging the parent node, then all the remaining childs get added under the same parent in another tree, even if we leave the drag over another parent node.

Note:
The node ids should be same on both trees.

So, i created each node manually and deleted each manually. It’s working fine, but i get the following error after deleting the Parent node, and again i drop the same parent from another tree.

Error:
getItem [The item 1 not operable. Seems you have non-unique|incorrect IDs in tree’s XML.]

I had attached the sample zip file. Please, run it and give me a solution

Steps To Run:

  1. open sample.html file in browser.
  2. Drag any one of the parent node from the left tree to another tree.
  3. Now drag the same parent from the right tree to left tree. You can get the error.

I don’t know what went wrong, whether my approach on this is correct.

Thanks
Jaibabu
dhtml.zip (1.8 KB)

Problem confirmed
As fast solution - disable smartXMLParsing in both tree’s - it will fix the issue.

Hi stanislav,
Lot of thanks. Your solution worked like a charm. I can’t understand what went wrong in using smartXMLParsing enabled. If you have time could you please, explain briefly about this why it happens?

Thanks
Jaibabu

There is a known issue with smart rendering in tree and xml data. When you are using smart-rendering, the tree preserves original xml document and will use it for id location ( which allows to use tree API against not rendered items ). This works correctly, but when you are deleting item from tree, it is not deleted from the xml document. So while item is fully removed from the tree - it sill can be located in the stored xml. Now, when you are adding new item in to the tree - there is a new items with id=“1” and in same time, in the xml data the description of the original record with same id still exists, which results in above error.

When smart rendering disabled, original xml data is not preserved and above issue is not actual anymore.

Yes, that make sense. But, still i have one doubt. While deleting the parent node only we are facing that problem, but if we do so for the childs then everything working fine without the duplicate id issue. So, hope as per your explanation, this behaviour occurs only if we remove the whole item including the child. Is it correct?

Thanks
Jayasenthilbabu.J

We will investigate this scenario.

oh thanks Stanislav.