[英]Simulate drag and drop with jquery
我想用jquery或javascript模拟拖放。
我必须在要模拟拖放的数据表上。
<table class="dataTable table table-hover null table-cells dragDropTable table-draggable" id='tableListViewFields' data-testid='tableListViewFields'>
<thead>
<tr>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr class="drag-cue" data-name="test" data-index="1">
<td class="no-border-right">
test
</td>
</tr>
</tbody>
</table>
目标表看起来相同。
那么,如何模拟从行元素到另一个元素的拖放呢?
要模拟将第一行拖放到第二行,可以手动触发drop事件:
$( ".drag-cue:eq(1)" )
.trigger("drop", $( $( ".drag-cue:eq(0)" ) ));
我找到了另一个解决方案:我现在使用https://github.com/j-ulrich/jquery-simulate-ext/blob/master/doc/drag-n-drop.md ,该拖放操作非常容易实现
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.