简体   繁体   English

有什么办法可以对流星进行批量更新吗?

[英]Is there any way to make a bulk update in meteor?

I'm trying to order a reactive list of items with drag and drop. 我正在尝试通过拖放命令反应式列表。 Each time the list is reordered, an object with the position of each element sent to the server. 每次对列表进行重新排序时,带有每个元素位置的对象都会发送到服务器。

At the server, for each object an update is executed with the new position of element. 在服务器上,对于每个对象,使用element的新位置执行更新。

But this way, at each update, the entire list is again rendered. 但是这样,在每次更新时,整个列表都会再次呈现。

Is there any way to pause the reactivity until completion of all updates? 有没有办法在所有更新完成之前暂停反应?

Thanks in advance for any help you are able to provide. 在此先感谢您能提供的任何帮助。

Added: Do not reactive sort on update in Meteor 补充: 不要对Meteor中的更新进行反应式排序

What you describe isn't standard behavior. 您描述的不是标准行为。 They worked really hard to make things nicer. 他们非常努力地使事情变得更好。

Make sure each document area has a unique id in the dom. 确保每个文档区域在dom中都有唯一的ID。

<div id="books_{{_id}}">

Whatever you are sorting on, if moving something from the 8th position to the 3rd makes the 4th to 8th get renumbered, try a different technique. 无论您进行何种排序,如果将某些东西从第8位移到第3位都会使第4位到第8位得到重新编号,请尝试另一种方法。 Assign numbers with a large gap. 分配较大的数字。 Like 10,20,30,40. 像10,20,30,40。 Then, to reposition 80 to 3rd, just give record sort order 80 a sort order 25, half way between the other two. 然后,要将80重新定位到第3位,只需给记录排序顺序80一个排序顺序25,就在其他两个之间。 Combined with the unique ids, things are designed to be pretty efficient. 结合独特的ID,事物的设计效率很高。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM