在AngularJS禁用排序依据,同时编辑列表 [英] Disabling orderBy in AngularJS while editing the list
问题描述
适用排序依据
在我的输入框列表,如果我编辑它立即开始排序的任何领域,我失去重心后。我试图在角code至挖出,发现因此每当值改变它排序list.Is有什么办法来禁用排序依据,同时编辑他们已经申请类似$表上排序依据的属性?我不想让那种排序依据的数据,同时编辑文本。任何帮助将AP preciated
After applying orderBy
in my list of input boxes if i edit any field it starts sorting immediately and i loose focus. I tried to dug in the angular code and found out they have applied something like $watch on the orderBy's attributes therefore whenever the value changes it sorts the list.Is there any way to disable orderBy while editing? I dont want to let the orderBy sort data while editing text. Any help will be appreciated
注意:我想用排序依据和放大器;不需要像任何控制器本身的排序列表中的任何选择。我只想排序依据网页加载一次对列表进行排序,然后保持相当。
Note: I want to use orderBy & don't need any alternative like sorting the list from any controller itself. I just want the orderBy to sort the list once on page load and then remain quite.
推荐答案
我用排序依据
可能被使用的角排序,并遇到类似的问题。
I was using orderBy
on a list that could be re-ordered using angular-sortable, and ran into a similar issue.
我的解决办法是通过调用控制器内的排序依据
过滤器时,网页被初始化,然后调用它随后手动执行顺序,在必要时,例如在回调函数之后重新排序的列表中。
My solution was to perform the ordering manually, by calling the orderBy
filter inside the controller when the page was initialised, and then calling it subsequently when necessary, for example in a callback function after re-ordering the list.
这篇关于在AngularJS禁用排序依据,同时编辑列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!