angular ui sortable callback

混江龙づ霸主 提交于 2019-12-03 13:46:16

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.

Adam Spence

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">
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!