3

I am using jqgrid drag and drop , i have two tables TABLE A and TABLE B, i am draging one row from TABLE A and Droping into TABLE B, i Want to capture new row id and data received in table, is there any receive event in jqGrid ?

pradeep
  • 1,047
  • 3
  • 20
  • 24

2 Answers2

6

You can define ondrop event function (see this Link ) like following

jQuery("#table2").jqGrid('gridDnD', {
    ondrop: function (ev, ui, getdata) {
        // var acceptId = $(ui.draggable).attr("id");
        // getdata is the data from $('#table1').jqGrid('getRowData',acceptId);
        // so you have full information about dropped row
    }
});

inside of ondrop's parameters you will find all information which you need.

MNasir
  • 137
  • 7
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Hey Oleg, awesome help once again!! Can you please view [this related question](http://stackoverflow.com/questions/10146892/jqgrid-drag-and-drop-row-check) whenever you get the time? I would greatly appreciate it! – FastTrack Apr 13 '12 at 19:11
1
$("#gbox_destinationTable tr td").droppable({
    drop : function(event, ui) {
        var draggedHtml = ui.draggable.html();
        $(this).append(draggedHtml);
        deleteFromSource(ui.draggable.parent());
    }
});

function deleteFromSource(draggedObj) {
    $('#sourceTable').jqGrid('delRowData', draggedObj.attr('id'));
}

You may see the complete sample for jqgrid specific implementation here : http://jsfiddle.net/pragya91/fzkqxdxm/

pragya91
  • 52
  • 1
  • 11