Drag from JQGrid to jsTree v.0.9.9a

丶灬走出姿态 提交于 2019-12-12 14:24:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!