views:

33

answers:

1

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?

A: 

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*/}}});
Oleg
The {stop:null} is a little abrupt but it works; I think I'll use the other approach with minimal additional code in the /* do on drop */ area. Thanks for the tips!
John
@John: You welcome! I think also that some code inside the /* do on drop */ would be better. It you find some problem with It is the `stop:null` way you will have to write his own `stop` event handle. At least it is the place where original jqGrid `stop` event handle remove dropped row from the source grid.
Oleg