mbraak / jqTree

Tree widget for jQuery
https://mbraak.github.io/jqTree/
Apache License 2.0
1.02k stars 177 forks source link

got another issue, hope you can help me #163

Closed dimaninc closed 11 years ago

dimaninc commented 11 years ago

hello buddy, sorry its me again

i'm trying to connect jqtree and jqueryUI.droppable (i need to drop photo thumbnails to tree-view categories which are made with jqtree)

i've wasted the whole day but achieved no result - none of parts of tree-element (.jqtree-element, .jqtree_common, .jqtree-title) are able to recieve dropped objects

but when i create some static div below the tree and make it droppable - it works perfect!

could you please help me - what am i doing wrong? may be jqtree denies the all drap-and-drop actions to the tree except inner drag-and-drop?

thanks in advance!

mbraak commented 11 years ago

Hello Dimaninc,

The following code worked for me. I make each li element droppable in the onCreateLi callback.

$('#tree1').tree({
    autoOpen: true,
    onCreateLi: function(node, $li) {
        $li.droppable({
            drop: function(e) {
                console.log('drop', e);
            },
            activate: function(e) {
                console.log('activate');
            }
        });
    }
});

Cheers, Marco

dimaninc commented 11 years ago

shame on me!.. thanks!

optyler commented 10 years ago

If you have much elements, this is not a good solution because, you are declaring as much droppables as you got <LI> elements. The best choice, I think, is declaring the top element <UL> as droppable and use the option tolerance: "pointer" from jQuery droppable.