开始-集合未填充视图

Getting Started - Collection is not populating View

本文关键字:填充 视图 集合 开始      更新时间:2023-09-26

我尝试通过

来呈现这些数据
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事件