angular ui sortable callback angular ui sortable callback angularjs angularjs

angular ui sortable callback


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.


I prefer to use an options hash with my update callback defined, in my scope like this:

$scope.sortableOptions = {    disabled: false,    update: function(event) {        return $scope.sortableUpdated = true;    }};

and in the template:

<div ui-sortable="sortableOptions"> ...


Reading through the ui-sortable file (there isn't a demo of it on the angular-ui homepage, wonder why?) here, I see that it allows for 2 callbacks -> start and update, for before and after the change you trigger.So something like this should work:

<tbody id="existingStockResults" ui-sortable update="myCallback()" ng-model="processes">