【发布时间】:2015-07-29 05:37:18
【问题描述】:
我正在使用HTML 表,其中一些数据被动态添加到表中。
表id 和title 中有两列。我正在使用jQuery UI sortable 对表格行进行排序。 HTML 和JS 如下:
<table class="table table-striped table-bordered" id="questions-list-table">
<thead>
<tr>
<th>ID</th>
<th>Title</th>
</tr>
</thead>
<tbody>
<tr>
<td> 1 </td>
<td>Title 1</td>
</tr>
<tr>
<td> 2 </td>
<td> Title 2</td>
</tr>
</tbody>
</table>
<script>
$(document).ready(function() {
$("#questions-list-table tbody").sortable({
disableSelection: true,
placeholder: "ui-state-highlight",
axis:"y",
stop: function(e) {
console.log("Sorting started");
}
});
});
</script>
目前整行正在排序。我希望唯一的标题是可排序的,id 列应保留在其原始位置。我该怎么做?
【问题讨论】:
标签: javascript jquery jquery-ui