I'm using jquery treeview plugin and I want to add drag & drop feature by using
Drag n Drop of interface
Here the code so far ( from source ).
$('span.folder').Droppable(
{
accept : 'file',
hoverclass : 'dropOver',
activeclass : 'fakeClass',
tollerance : 'pointer',
onhover : function(dragged)
{
},
onout : function()
{
},
ondrop : function(dropped)
{
var $dropped = $(dropped);
var $parent = $dropped.parent();
$parent.removeClass("last");
// try to remove first
$("#browser").treeview({
remove: $parent
});
var $this= $(this);
var container = $this.next();
$("span").appendTo("#foo");
var branches = $parent.prependTo("#"+container.attr("id"));
$("#browser").treeview({
add: branches
});
// recall droppable
$drag.DraggableDestroy(); (1)
$drag.Draggable( (2)
{
revert : true,
autoSize : true,
ghosting : true
}
);
}
}
);
var $drag = $('span.file,span.folder').Draggable(
{
revert : true,
autoSize : true,
ghosting : true
}
);
}
);
(1) (2) After dragging one file item to a folder, I can not drag it again. So I played a trick by destroy current dragable object and init it again.
It is not cool. But I don't know how to overcome this.
The example here works well. Any help?
Đăng ký:
Đăng Nhận xét (Atom)
Không có nhận xét nào:
Đăng nhận xét