Skip to content Skip to sidebar Skip to footer

Drag From JQGrid To JsTree V.0.9.9a

I am looking to drag a row from the jqGrid I have created and fire a drop event on a node in the jsTree (v.0.9.9a). Is there anyway to do this - using v.0.9.9a of the jsTree only.

Solution 1:

This is a really narrow question. It sounds like both controls use the jQuery UI draggable and droppable widgets, and that you have a preliminary approach. Why not try implementing your idea and see how well it works?

I would encourage you to post your code when you are done, or if you get stuck along the way...


Solution 2:

After much debate, i've decided to switch to jsTree version 1.

In jqGrid I added the event

afterInsertRow: function (rowid, rowdata, rowelem) {
            $("#" + rowid).addClass('jstree-draggable');
        },

I then added the dnd plugin for the jstree, which allows all external elements with the class "jstree-draggable" to be dragged into the tree with the event "drag_finish": function (data) {} in the jsTree.

While jsTree version 1 is a pain to switch to after using pre-Version 1 it really is a lot faster, neater and easier to use once you get the hang of it. I'm told that full documentation will be released with the version 1 final.


Solution 3:

just:

$("#treeOptions").jstree({
   plugins: ["themes", "json_data", "dnd", "ui", "types"],
   ...
   dnd: { drag_target: ".jqgrow" }
   ...
});

Post a Comment for "Drag From JQGrid To JsTree V.0.9.9a"