JsTree with dnd plugin, always copy

I have two trees using jsTree and dnd plugin.
I want every drag and drop operation to be a copy instead of moving.
There is a “copy_modifier” that Ok works when a modifier key is pressed, but I want the copy to be by default without a modifier. Any ideas?

Thanks
Adrian

+3
source share
3 answers

Found a solution on http://groups.google.com/group/jstree
When setting up jsTree, I added the following section:
"crrm": {"move": {"always_copy": "multitree"}}

, ,

+3

Adrian . , dnd dnd.always_copy

. , , dnd, inter tree dnds , , :

  • copy_node.jstree . data.is_multi ( )

  • check_callback, is delete_node , false, dnd.

+2

another solution for the new version. It works, but not fully tested.

"core": {
    "check_callback": function (operation, node, node_parent, node_position, more) {
        if (more) {
            if (more.is_multi) {
                more.origin.settings.dnd.always_copy = true;
            } else {
                more.origin.settings.dnd.always_copy = false;
            }
        }
        return true;
    }
}
+2
source

Source: https://habr.com/ru/post/1765268/


All Articles