javascript - Drag and Drop between 2 tables using Jquery sortable with rowspan and colspan -
i`m trying move row has rowspan > 2 or colspan > 2 in table.
the problem when drop cell , creates new tr in cell.
i`m thinking set parent rowspan or colspan same child when dragged object dropped.
http://jsbin.com/jumalofe/1/watch?html,js,output
let`s "aibd" should 08-00 12:00 . how should that??
here's do. use receive
event of sortable:
receive( event, ui )
this event triggered when item connected sortable list has been dropped list. latter event target.
receive:function(event, ui) { //we check if <td> has rowspan property if(typeof ui.item.attr('rowspan') !== 'undefined' && ui.item.attr('rowspan') !== false){ //if does, store in variable rowspan = ui.item.attr('rowspan'); //the element dropping to, set rowspan there //(content automatically inserted) $(this).attr('rowspan',rowspan); //we set rowspan of sender element 0, case //you re-dragging 'aidb' other row, if do, //we want previous row same before, free of rowspan ui.sender.attr('rowspan',0); } //same case colspan if(typeof ui.item.attr('colspan') !== 'undefined' && ui.item.attr('colspan') !== false){ colspan = ui.item.attr('colspan'); $(this).attr('colspan',colspan); ui.sender.attr('colspan',0); } }
Comments
Post a Comment