拖放2个表之间使用Jquery排序与rowspan和colspan
Drag and Drop between 2 tables using Jquery sortable with rowspan and colspan
我正在尝试将rowspan> 2或colspan> 2的行移动到另一个表中。
问题是,当我将它放入单元格中时,它会在该单元格中创建一个新的tr。
我想设置父rowspan或colspan相同的子当拖动对象被丢弃。
http://jsbin.com/jumalofe/1/watch?html、js、输出
假设"AIBD"应该从08-00到12:00。我该怎么做呢?
你应该这样做。我们将使用sortable:
的receive
事件当连接的可排序列表中的项被删除时触发此事件被放到了另一个列表中。后者是事件目标。
receive:function(event, ui) {
//we check if the <td> has rowspan property
if(typeof ui.item.attr('rowspan') !== 'undefined' && ui.item.attr('rowspan') !== false){
//if it does, we store it in a variable
rowspan = ui.item.attr('rowspan');
//the element we are dropping to, we set the rowspan there
//(content is automatically inserted)
$(this).attr('rowspan',rowspan);
//we set the rowspan of sender element to 0, this is the case where
//you are re-dragging the 'AIDB' to some other row, if you do,
//we want the previous row to be same as before, free of any rowspan
ui.sender.attr('rowspan',0);
}
//same case for 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);
}
}
相关文章:
- JavaScript数组排序(函数)用于对表行进行排序,而不是排序
- 使用promise和mongoose对文档进行排序
- Selectize.js:如何对整数值的选项进行排序
- Javascript排序的图像弹出窗口..可以't单独弹出
- 如何通过引用var Using DataTables来进行分页或排序
- 为什么HTML5拖放的目标是孩子?(可排序列表)
- AngularJs对所有页面中的所有记录进行排序
- 当属性不一致时,如何根据属性对JS对象列表进行排序
- 按从高到低对多个int变量进行排序
- jQuery UI可排序-多连接列表拖动
- Javascript排序字符串或数字
- 2个backbone.js集合,具有相同的模型,但排序顺序不同
- sort而不是排序javascript
- 通过从节点父级获取所有子级对节点进行排序(获取子级数组)
- 如何合并不同集合的游标并按日期排序
- 为什么我的JavaScript堆栈排序函数不起作用
- ui网格:在自定义表头模板中触发排序
- jquery Onclick函数带有导致双击的回调排序函数
- 拖放2个表之间使用Jquery排序与rowspan和colspan
- HTML表格与rowspan重新排序项目拖放问题