Categories | Question details Back To List | ||
Incorrect id of copied element from DataProcessor Hi, 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. Answer posted by Support on Jan 08, 2009 10:04 >> 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. Answer posted by Michal Smolinski on Jan 09, 2009 04:51 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. Answer posted by dhxSupport on Jan 09, 2009 08:09 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 tree.enableMercyDrag(false) tree.moveItem(... tree.enableMercyDrag(true) Answer posted on Jan 09, 2009 08:11 Thanks, that should do the trick. Is there any way to discover if enableMercyDrag is enabled? Answer posted by Support on Jan 09, 2009 10:14 There is no public method, but you can use inner flag if (tree.dpcpy) mode_is_on(); |