Wrong target id returning at the time of drag drop

Hi All,

I am trying to move an item which contains sub items with n level between two items those are containing n level of sub items . But the problem is in this situation the dragged item is added in the second item as a sub item . But if the second item contains only one level sub item then it is working fine . I have checked and found that it is getting the wrong target id.
I am adding a image overview for this.

Can anyone help me out.

Thanks in advance,
Sarit

Hi,

I am adding a image overview for this.
there isn’t attached image.

The problem isn’t clear from the description

Hi,

At first sorry for post previous query without image . Here is the image(my drawing is not so good :frowning: ) which may clear my query.
Thanks in advance
sarit

Hi,

tree has 3 drag-n-drop modes: child(default), sibling and complex.

dhtmlx.com/docs/products/dht … mplex.html

dhtmlx.com/docs/products/dht … g_ext.html

The issue that you described may occur if “complex” mode is used and “C” item dropped as a child. You may use “sibling” mode if you want to prevent child drag-n-drop.

Moreover, you may use onDrag and onDragIn events to control drag-n-drop.

yes I understood, but the problem is user can drag drop the item as a child or as a sibling. How can I know what the user actually wants to do. That’s why I used drag behavior as complex. At the time of before dropping the line shows the position of drop is showing correctly, but after dropping it is adding as a child what i mentioned previously.

I have already used onDragIn to check from which tree user tries to drag in the item.

Please tell me how to add the item in that position where user wants to add(may be as a sibling or as a child ) considering the situation what I mentioned early.

Thanks

At the time of before dropping the line shows the position of drop is showing correctly, but after dropping it is adding as a child what i mentioned previously.

What tree version do you use ? Please provide the complete demo to recreate the problem.

Hi,
I think I am using 1.4 version. But I have also tried the latest release where I am getting another error setDragBehavior is not a function. I checked the dhtmlxtree.js and dhtmlxcommon.js where I didn’t found any function name setDragBehavior, why I don’t know. Is there other function has been given for the same functionality ? or my .js file is corrupted?. As well as the problem what I have already discussed with you I got the problem in dhtmlx site also.
Address is : dhtmlx.com/docs/products/dht … g_ext.html

Try to drag teens element between Horror and science fiction nodes. Teen is adding as a child node of Horror->Dan Brown->teens.

But if u drag and drop between History and Horror it is working fine.

Please suggest me what to do next?

Thanks again

Hi,

But I have also tried the latest release where I am getting another error setDragBehavior is not a function.

Which tree edition do you use: PRO or Standard ? setDragBehavior is available on in PRO.

As well as the problem what I have already discussed with you I got the problem in dhtmlx site also.

We haven’t recreated the problem locally. In the right tree, where drag behavior is sibling, the “teens” item is dropped between “history” and “horror” (tested in both IE and FF).

Hi,

I downloaded the standard version.
Try to drop teens node between Horror and Science Fiction & Fantasy, then you will get the problem.

Hi,

the standard version doesn’t provide setDragBehavior method to set “sibling” drag-n-drop. Therefore, item is dropped as a child of “history” item.

You may use moveItem method to move item to the necessary position.