私はいくつかのテーブルを持っています、例えば:
<table class="table table-hover table-striped" id="mytable">
<thead>
<tr>
<th>#</th>
<th>Table heading 1</th>
<th>Table heading 2</th>
<th>Table heading 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
</tr>
</tbody>
</table>
次に、ソート可能なテーブルの行ヘッダーを作成したいと思います。
$('#mytable thead tr').sortable({
axis: "x",
helper: "clone"
}).disableSelection();
問題:
ドラッグ アンド ドロップを開始するとth
、4 つではなく 6 つの -s が表示されます。
<tr class="ui-sortable">
<th>#</th>
<th style="
display: none;">Table heading 1</th>
<th class="ui-sortable-placeholder"
style="
visibility: hidden;"></th>
<th>Table heading 2</th>
<th>Table heading 3</th>
<th style="
display: table-cell;
width: 343px;
height: 37px;
position: absolute;
z-index: 1000;
left: 184px;"
class="ui-sortable-helper">Table heading 1</th>
</tr>
..そして、すべてのマークアップが非常に不安定で不確実になり始めますth
。アイテムをテーブル上にドラッグすると、すべての行のサイズがジャンプするのが見えます。
これは、count アイテム (のアイテムth
数と等しくない)が原因で発生することは明らかです。td
tr
これを修復する方法は?