I am brand new to Webix. In my previous experience with tree drag and drop, the dragged item always becomes a child of the item it is dropped on. The position of the dropped item among its new siblings is either first, last, or is based on the sort of some value. Is there any way I could achieve a similar behavior in Webix, perhaps by using events.
Yep, sure
Check http://docs.webix.com/samples/15_datatable/31_treedrag/04_drop_as_child.html
Don’t mind that the above is a sample of a treetable. TreeTable and Tree behave in the same way during drag-n-drop.
The customizaton can be done by using onBeforeDrop event
on:{
onBeforeDrop:function(context){
context.parent = context.target; //drop as child
context.index = -1; //as last child
}
},
Other possible modes:
http://docs.webix.com/samples/15_datatable/31_treedrag/
http://docs.webix.com/desktop__dnd_hierarchy.html
Thank you. The settings as defined in your links above to cause the dropped child to be first among its new siblings, i.e. context.index=0, worked perfectly for me. However, the above code which employs context.index=-1, seems to place the dropped item second-to-last rather than last. I will need to check further.
I can confirm the issue, it looks as regression in one of latest build.