我尝试通过
来呈现这些数据this.listenTo(this.collection, 'reset', this.render);
console.log(this.collection);
我假设复位事件被调用时,我做取回,但我不是100%确定。
My Collection定义如下:
var FavoritesTable = Backbone.Collection.extend({
Name: 'FavoritesTable',
model: FavoritesRow,
url: $A.Reg.get('_path_ajax'),
initialize: function (models, options) {
console.log(this.fetch(options));
}
});
如果你想让fetch
重置一个集合,你可以传递{reset: true}
作为选项。Docs .
根据消息来源,不触发reset
事件,触发sync
事件