开发者

jqGrid drag and drop a copy of the row, rather than moving the row?

开发者 https://www.devze.com 2023-01-19 07:28 出处:网络
It\'s easy to connect two grids for Drag and Drop开发者_StackOverflow社区: jQuery(\"#sourceGrid\").jqGrid(\'gridDnD\',{connectWith:\'#targetGrid\'});

It's easy to connect two grids for Drag and Drop开发者_StackOverflow社区:

jQuery("#sourceGrid").jqGrid('gridDnD',{connectWith:'#targetGrid'});

However, this moves the row from source to target. I want to copy the row from source to target.

The default "drag_opt" for gridDnd includes "helper: 'cone'", but it doesn't appear to be cloning. Does anybody have a trivial addition to the above jqGrid that accomplishes copy rather than move?


Use the dragcopy option when setting up the DnD options:

jQuery("#sourceGrid").jqGrid('gridDnD',{connectWith:'#targetGrid', dragcopy: true});

Link to documentation


You can try to use

jQuery("#sourceGrid").jqGrid('gridDnD',
                             {connectWith:'#targetGrid',drag_opts:{stop:null}});

or

jQuery("#sourceGrid").jqGrid('gridDnD',
                             {connectWith:'#targetGrid',
                              drag_opts:{stop:function(event,ui) {/*do on drop*/}}});
0

精彩评论

暂无评论...
验证码 换一张
取 消