Is there a way to set a callback function with angular ui's sortable? I'd like to add ng-update="foo()" to the tbody tag below and have foo run whenever the list changes.
<tbody id="existingStockResults" ui-sortable ng-model="processes">
<tr ng-repeat="process in processes" ng-class="{odd: $index%2 == 0, even: $index%2 != 0}">
<td>{{process.process}}</td>
<td>{{process.vendor}}</td>
<td>{{process.desc}}</td>
<td>{{process.cost}}</td>
<td><a href="#" ng-click="editProcess($index)">edit</a></td>
<td><a href="#" ng-click="removeProcess($index)">remove</a></td>
</tr>
</tbody>
thanks!
You can now specify the update function in the ui-sortable
attribute, like this:
<tbody ui-sortable="{update: foo()}">
But there still are a few issues with the sortable directive, like in this example. They are currently discussed here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With