角度 ui 可排序回调 [英] angular ui sortable callback
本文介绍了角度 ui 可排序回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法用 angular ui 的 sortable 设置回调函数?我想将 ng-update="foo()" 添加到下面的 tbody 标记中,并在列表更改时运行 foo.
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>
谢谢!
推荐答案
您现在可以在 ui-sortable
属性中指定更新函数,如下所示:
You can now specify the update function in the ui-sortable
attribute, like this:
<tbody ui-sortable="{update: foo()}">
但是 sortable 指令仍然存在一些问题,例如这个例子.它们目前正在此处讨论.
But there still are a few issues with the sortable directive, like in this example. They are currently discussed here.
这篇关于角度 ui 可排序回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文