Topic: dnd with custom elements

Hi,
i want to be able to drop custom DOM objects into a tree node/folder.

I have elements like this:
<div id="someId" class="folderDropable">some item</div>

experimented with code like this, but can't get it working:

$$('div.folderDropable').each(function(el){
                el.setStyle('color', 'red');
                dnd = new Mif.Tree.Drag.Element({
                    element: el,
                    options: {
                        onStart: function() {
                            console.log('start dragging');
                        }
                    }
                });
            });

any help ?

thanks!

Last edited by almoehi (2010-01-16 19:32:07)

Re: dnd with custom elements

Mif.Tree.Drag.Element is droppable for dragged tree nodes (name may confuse you, but it's so).

How it will work, how you want convert some div or other dom element into tree node?

Re: dnd with custom elements

mmh ok how can I do this?

My elements could be anywhere on the page, and should not apear inside the tree.
It should work like a shopping cart where you can drop elements into.

Re: dnd with custom elements

It's hard to do, there is no built-in methods, I'll try to make a small example of how you can move something in a tree

Re: dnd with custom elements

great - thanks!

Re: dnd with custom elements

commit 76e68ce59 add drag from element to tree demo.