在AngularJS禁用排序依据,同时编辑列表依据、编辑、列表、AngularJS

由网友(没胆挂念)分享简介:适用排序依据在我的输入框列表,如果我编辑它立即开始排序的任何领域,我失去重心后。我试图在角code至挖出,发现因此每当值改变它排序list.Is有什么办法来禁用排序依据,同时编辑他们已经申请类似$表上排序依据的属性?我不想让那种排序依据的数据,同时编辑文本。任何帮助将AP preciated After applyi...

适用排序依据在我的输入框列表,如果我编辑它立即开始排序的任何领域,我失去重心后。我试图在角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

这里是我的plunker

注意:我想用排序依据和放大器;不需要像任何控制器本身的排序列表中的任何选择。我只想排序依据网页加载一次对列表进行排序,然后保持相当。

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.

阅读全文

相关推荐

最新文章