Topic: drag'n'drop between multiple trees, droppables option

Hi!

It seems to me that all tree instances become automatically implicitly droppables for all other trees

Looking at the dnd demo:
For tree on the left side one defines explicitly ONE droppable, that is drop_container, BUT
I can still drop into tree2 on the right side. (is any other tree an automatic implicit droppable per default? is there a way to avoid this and control ALL droppables manually?)

In my case I want to "construct" the right tree from the left tree, that is
- dragging nodes from the LEFT tree to RIGHT tree is ALLOWED
- draggng nodes from LEFT tree and dropping them in the LEFT tree (reordering left tree) - is NOT ALLOWED
- dropping nodes to the LEFT tree from any other trees(right tree) is NOT ALLOWED

How can I achieve this?

regards!

Re: drag'n'drop between multiple trees, droppables option

solved.

one can achieve the thing I wanted solely by implementing Mif.Tree.Drag callbacks passed via it's constructor:

for left tree:
     onDrag: function() { this.where='notAllowed';  }

    this forbids to drop anything in the left tree.

for right tree:
  beforeDrop:function(current, target, where) {
    this.action = (current.tree === tree) ? 'copy' : 'move'; // assuming tree is the global variable for left tree
    this.drop();
  }

  this is necessary so that, if node is dragged from left tree to right tree it must be COPIED
  however if a node is dragged from and dropped to the right tree - it must be MOVED


Several assumptions:
The library is great, though IMHO naming is in some cases not perfect, and naming DOES MATTER especially when the thing grows.

1) Why is this callback for left tree I had to use is called onDrag? It's about dropping. That's very confusing.
    Maybe I'm using the wrong callback for the thing (I've copied this from some other forum post)
    If so - what would be the right one?
2) If something is called "beforeDrop", one expects that drop would occure anyway after this callback,
    however, it does not and one must explicitely call this.drop().
    This callback should have rather been called onDrop, or something, but "before" does not really fit here.

In any case - MANY thanks for your work and this great library!

Re: drag'n'drop between multiple trees, droppables option

beforeDrop temp solution and will be changed in future version, onDrag fires every time when you moving(dragging) node, it's the same event name as in mootools Drag class.