jQuery UI Widgets › Forums › Navigation › Tree › How to detect invalid drop target in tree
This topic contains 6 replies, has 2 voices, and was last updated by Stork 11 years, 8 months ago.
-
Author
-
Hello there,
I can’t find a way how to detect attempts to drag & drop node to some of its child nodes. Tree itself doesn’t allow it, alias its structure is not changed when user tries to do that stupid thing, but I need to detect it somehow (to not call update on backend), because both function dragEnd and event dragEnd are called/fired on jqxTree.
Did I overlooked something, please? Thanks.
Hello stork,
As shown in the jqxTree demo Drag and Drop, when dragging an item, its dragEnd event is called, but you may choose not to do anything under certain circumstances (as is the case with the “Forum” item).
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar,
I’m afraid you didn’t answered my question.
Please, in left tree of that demo, try to drag item ‘Solutions’ and drop it to ‘Education’. How can I add listener to that event when tree itself refuses to create circular reference, or how can I detect this from arguments of dragEnd function or event? How does jqxTree expose to dragEnd function/event failing result of drag&drop operation?
Thank you, Stork.
Hi Stork,
In the dragEnd property/callback function check for the value of
$.contains(item.element,dropItem.element)
If it is false, the element has successfully dropped on the target. The code above checks whether the dragged item is a parent of the item under the mouse cursor.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar, thank you very much. Have a nice day! S.
Hi Dimitar,
unfortunately, in IE8 your solution always returns true. I’ve tried several constructions with is() and has() using parents() and children(), without luck in IE8.
Any advice, please? We can not drop support for IE8 in this application…
Thank you, stork.
…and another issue I found just now – argument dropPosition of dragEnd property/callback is ‘undefined’ in IE7 and IE8.
These 2 things (no possibility to get success/error result of drag and drop, and not working dropPosition in IE7/8) are making jqxTree completely unusable with drag and drop.
-
AuthorPosts
You must be logged in to reply to this topic.