i am using the HTML Table with some data being dynamically added to the table.
There are two columns in the table id & title. I am using jQuery UI sortable to sort the table rows. The HTML and JS are as below:
<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>
Currently whole row is getting sorted. I want that only title to be sortable, the id column should remain in its original place. How can i do that?