jQuery重新排序表列
我找到了适用于行的各种解决方案以及适用于纯表列的各种解决方案,但是我需要一个允许我将列标题拖放到colspan> 1的解决方案.
I've found various solutions that work for rows, and various solutions that work for plain-table columns, but I need a solution that allows me to drag/drop the headers of columns where colspan>1.
例如:
<table id="myTable">
<thead>
<tr>
<th>A1</th>
<th colspan=2>A2</th>
<th>A4</th>
<th>A5</th>
</tr>
</thead>
<tbody>
<tr>
<td>B1</td><td>B2</td><td>B3</td><td>B4</td><td>B5</td>
</tr>
<tr>
<td>C1</td><td>C2</td><td>C3</td><td>C4</td><td>C5</td>
</tr>
</tbody>
</table>
当我将A2拖放到标题中的其他位置时,我需要能够重新排列列并让B2/B3和C2/C3移动.
I need to be able to re-order the columns and have B2/B3 and C2/C3 get moved when I drag/drop A2 to a different spot in the header.
有许多提供表拖放功能的jquery插件.由于col-span不止一个的问题很复杂,请查看下面的链接.这是JS FIDDLE
There are lot of jquery plugins that provision of drag and drop of table. as the problem complex for col-span more than one, check the link below. here is JS FIDDLE
添加了四个外部资源.参考插件: https://akottr.github.io/dragtable/
there are four external resources added. for a reference plugin : https://akottr.github.io/dragtable/