问题
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.
Regards.
回答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...
回答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.
回答3:
just:
$("#treeOptions").jstree({
plugins: ["themes", "json_data", "dnd", "ui", "types"],
...
dnd: { drag_target: ".jqgrow" }
...
});
来源:https://stackoverflow.com/questions/3300258/drag-from-jqgrid-to-jstree-v-0-9-9a