How to drop item into a tree node with jQuery


#1

I’m having difficulty getting a tree node to receive an element via jQuery drag and drop.

I created the tree with this code and loaded the tree data:
myTree = new dhtmlXTreeObject(“ft-panel”,“100%”,“100%”,0);

jQuery(‘ft-panel’).droppable( {
accept: ‘li a.media-attachment’,
hoverClass: ‘standartTreeRow’,
drop: handleTreeDropEvent
});

The draggable and droppable jQuery files have been loaded, but the drop does not fire when I drop an item on a tree node.

The draggable element works fine and is defined as

jQuery(“li a.media-attachment”).draggable({
cursor: “move”,
helper: function() {
var selected = jQuery(".media-list input:checked").parents(“li”);
if (selected.length === 0) {
selected = jQuery(this);
}
var container = jQuery("

").attr(“id”, “draggingContainer”);
container.append(selected.clone());
return container;
}