开发者

jqGrid drag and drop Receive event

开发者 https://www.devze.com 2022-12-30 11:54 出处:网络
I am using jqgriddrag and drop , i have two tables TABLE A and TABLE B, i am draging one row fromTABLE A and Droping into TABLE B,i Want to ca开发者_JAVA百科pture new row id and data received in table

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 ca开发者_JAVA百科pture new row id and data received in table, is there any receive event in jqGrid ?


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.


$("#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/

0

精彩评论

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

关注公众号