javascriptjqueryjstreejstree-dnd

How to use jstree v3 plugin with reorder only


I am using jsTree V3.0.8 (http://www.jstree.com/)

how to reorder only when use dnd plugin like at V1(http://johntang.github.io/JsTree/_docs/dnd.html#demo2)


Solution

  • Use the check_callback option like this:

    "check_callback" : function (op, node, par, pos, more) {
        if(more && more.dnd) {
            return more.pos !== "i" && par.id == node.parent;
        }
        return true;
    },
    

    Here is a demo: http://jsfiddle.net/DGAF4/509/