Incorrect id of copied element from DataProcessor


from unknown reason, id of copied element of the tree is not updated after DataProcessor processing. Strange, but there is a change in id of element which I copied, not id of a copy. I can workaround that with simple swap of sid and tid in response, but again, id of the copy is not changed. It’s equal to id of the original element, with some suffix, like _1231421764445.

Is it a bug? How can I update id of the copy to the proper value? I tried with DP.defineAction, but with no luck.

It’s equal to id of the original element, with some suffix, like _1231421764445.
When existing element copied it receives temporary ID which contains from original id plus some unique part.
Please be sure that you returning correct sid value ( it must be id of new item ), dataprocessor just change id of “sid” to the “tid”, so if “sid” points to the source item ID - it will be updated instead of child.

Ok,  that works great. But I got another problem.
After the item is copied, I check it’s index (order in the tree), and eventually change the order with the “tree.moveItem” method. It works fine for move operation, but with copy (actually insert) it tries to do another insert, so after item ‘l45_41_1231502217747’ is inserted, I launch moveItem method, and then, there is a new insert of id ‘l45_41_1231502217747_1231502221963’. And I end up with two same nodes in the tree. All of that happens inside “DataProcessor.defineAction(“insert”, myFunction)” handler.

The behavior of moveItem affected by enableMercyDrag command.
So, if you have used enableMercyDrag to enable “copy” mode, the next call to the moveItem will be affected by it as well, and instead of moving , item will be copied.
You can try to use


Thanks, that should do the trick. Is there any way to discover if enableMercyDrag is enabled?

There is no public method, but you can use inner flag
if (tree.dpcpy) mode_is_on();