John
John

Reputation: 13

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

It's easy to connect two grids for Drag and Drop:

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?

Upvotes: 1

Views: 2746

Answers (2)

NathanDykstra
NathanDykstra

Reputation: 85

Use the dragcopy option when setting up the DnD options:

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

Link to documentation

Upvotes: 2

Oleg
Oleg

Reputation: 221997

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*/}}});

Upvotes: 1

Related Questions