Topic: copy tree node without ctrl key

hello everybody,

I have two trees, and I would like to always copy a node from one tree to the other one.
is it possible? how can I do it?

thanks a lot,
claudette.

Re: copy tree node without ctrl key

u can add action:'copy' and u will always copy nodes instead moving:

tree = new Mif.Tree({
    container: $('tree_container'),
    initialize: function(){
        new Mif.Tree.KeyNav(this);
        new Mif.Tree.Drag(this, {
            action:'copy',
            ...
        })
    }
...

Re: copy tree node without ctrl key

thank you moro for your quick response!

but I only have to copy when I'm dragging from one tree to another, not within a tree. How do I know from which tree the current dragged node  is?

thanks in advance!

claudette.

Re: copy tree node without ctrl key

try implement custom action. You can use this code as prototype (here idea, not a real example):

...
new Mif.Tree.Drag(this, {
            action:'dndCustomAction',
            ...
        });
...


Mif.Tree.implement({

    dndCustomAction: function(current, target, where){
        if(current.tree==target.tree){
            current.tree.move(current, target, where);
        }else{
            current.tree.copy(current, target, where);
        }
    }
    
});

Re: copy tree node without ctrl key

great ! thank you !

best regards,
claudette