jQuery UI Widgets › Forums › Navigation › Tree › How to Determine target of drag/drop
This topic contains 3 replies, has 2 voices, and was last updated by Hristo 6 years, 6 months ago.
November 22, 2016 at 8:23 am How to Determine target of drag/drop #89209
Inside the ‘dragEnd’ event, how can I determine where the object was dragged in terms of parent/child?
I have a table named “Group” that has 3 fields : 1) ID – 2) ParentID – 3) Title. when I drag an Item to another, I want to change the Item parent to new one. Like if I have these data inside the table:
ID – ParentID – Title
1 – 0 – A
2 – 0 – B
3 – 1 – C
4 – 1 – D
5 – 2 – E
6 – 2 – F
and I drag “F” to “A”, I want to change the Parent of “F” from 2 to 1, how can I do that ?
I can get The “F” ID by:
var item = $(#jxqTree).jqxTree(‘getSelectedItem’);
var itemID = $(item).attr(‘id’);
but how can I get the “A” (parent node) ID ?
Thanks in AdvanceNovember 22, 2016 at 3:15 pm How to Determine target of drag/drop #89230
What you would like to achieve. If I understand, you could achieve this change with two methods –
Please, take a look at this example.
Hope this helps.
http://www.jqwidgets.comNovember 22, 2016 at 3:26 pm How to Determine target of drag/drop #89231
Thanks for your comment, but your solution is Not what I am looking for. I need to get 2 parameters :
1) the ID of the element that I want to drag it based on the table in my data base.
2) the ID of the element that is destination of drag/drop action based on the table in my data base.
I can get the firs parameter by code:
var item = $(#jxqTree).jqxTree(‘getSelectedItem’); var itemID = $(item).attr(‘id’);
so the firs parameter is “itemID”. but I do not know how to get the second parameter.
Thanks in AdvanceNovember 23, 2016 at 7:51 am How to Determine target of drag/drop #89248
You could achieve this on the analogically way as in the shared example.
Set id for the items that want to make changes (as an element is removed).
I am not sure to understand you on the right way.
By default items do not have an id if you want could set to them.
Also, please, take a look at this example, there is one approach to set id:
You must be logged in to reply to this topic.