Ranjith Venkatesh
Ranjith Venkatesh

Reputation: 1362

jstree drag and drop not working

The check_callback is set to true and the plugin dnd is included but the drag and drop feature is not enabled. I see a "cannot drag" icon when I try dragging a leaf. What am I missing?

HTML:

<html>
    <head>
        <link rel="stylesheet" href="themes/default/style.min.css"/>
        <script type="text/javascript" src="jquery-1.8.2.js"></script>
        <script type="text/javascript" src="jstree.js"></script>    
        <script type="text/javascript" src="index.js"></script> 
    </head>
    <body>
        <table>
            <tr>
                <th>Tree</th>
            </tr>
            <tr>
                <td><div id="jstree"></div></td>
            </tr>
        </table>
    </body>
</html>

JS:

/*jslint browser: true*/
/*globals $, alert*/
$(function () {

    'use strict';

    var jstreeOriginal = $('#jstree');

    jstreeOriginal.bind("loaded.jstree", function () {
        jstreeOriginal.jstree("open_all");
    });

    jstreeOriginal.jstree({
        "core": {
            "check_callback": true,
            "themes": { "stripes": true },
            "data": [
                       { "id" : "ajson1", "parent" : "#", "text" : "Root node" },
                       { "id" : "ajson2", "parent" : "ajson1", "text" : "Child node" },
                       { "id" : "ajson3", "parent" : "ajson2", "text" : "Sub Child 1" },
                       { "id" : "ajson4", "parent" : "ajson2", "text" : "Sub Child 2" },
                    ],
            "plugins": [ "dnd", "wholerow" ]
        }
    });

});

Upvotes: 0

Views: 1414

Answers (1)

jb001
jb001

Reputation: 31

Put the "plugins" : [ "dnd", "wholerow" ] outside of your core

Upvotes: 1

Related Questions