在一個html表中,我在每一行中都有一個自己的位置編號的單元格。如何在使用jQueryUI排序後正確刷新此位置編號?jQuery ui可排序的表格刷新裏面的數字位置
這是我簡單的HTML:
<table border="0">
<thead>
<tr>
<th scope="col">Position number</th>
<th scope="col">Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Text</td>
</tr>
<tr>
<td>2</td>
<td>Text</td>
</tr>
</tbody>
</table>
,這是我的js:
var fixHelper = function(e, ui) { ui.children().each(function() { $(this).width($(this).width()); }); return ui; };
$("table tbody").sortable({
helper: fixHelper
}).disableSelection();
現在,我想正確更改訂單完成排序之後數值的位置。
我該如何做到這一點?
任何幫助,將不勝感激。
非常感謝你,很好的答案和很好的解釋,它完美的作品。 我接受併爲您的答案投了票,如果您願意,您也可以爲我的問題做同樣的事情。非常感謝! – bobighorus 2012-01-05 11:18:39
幫助我 - 很好的迴應和問題 – cantera 2012-04-18 03:01:32