I have a problem with jquery sortable on table. My table goes like this:
<table>
<thead>
<th>Number</th>
<th>Text</th>
<th>Order</th>
</thead>
<tbody id="sortable" data-bind="foreach: fruits">
<tr class="ui-state-default">
<td data-bind="text: number"></td>
<td data-bind="text: fruit"></td>
<td data-bind="text: order"></td>
<tr>
And I want this to make sortable, except on the order column, and I have this code, but it's not working
$( function() {
$( "#sortable" ).sortable({
items: 'td:not(:nth-child(3))' }
});
For example if I have
| Number | Fruit | Order |
|---|---|---|
| 1 | Banana | 5 |
| 2 | Apple | 10 |
| 3 | Peach | 15 |
When I change it, drag the whole row, I want to look like this, the order to remain the same:
| Number | Fruit | Order |
|---|---|---|
| 2 | Apple | 5 |
| 1 | Banana | 10 |
| 3 | Peach | 15 |