Jquery-UI sortable list not playing nice with reactive updates in Meteor template

后端 未结 2 1357
孤街浪徒
孤街浪徒 2021-02-06 15:56

I\'m trying to implement a sortable list of objects with JQuery-UI in the manner described at http://differential.com/blog/sortable-lists-in-meteor-using-jquery-ui.

How

2条回答
  •  面向向阳花
    2021-02-06 16:27

    Meteor/Blaze uses an _id attribute to identify data objects and link them to DOM elements. This applies not only to arrays of documents returned by a Collection cursor, but to any array of objects. So in the above issue, the problem was that I used an id value to identify each card rather than _id. Switching id to _id fixes the issue and allows Blaze to properly update the DOM, even if the DOM has previously been modified by JQuery-UI's sortable plugin.

提交回复
热议问题