1
我有一個採用parse
方法的此集合。我想要在收集完成時調用我的視圖中的方法parse
解析完成後,backbonejs發生火災事件
此集合將僅呼叫sync
,因此parse
只有一次。
我試過this.collection.on("reset", this.more, this);
但這不起作用。
more: function() {
var users = this.collection.slice(this.index, this.index + this.load_once), that = this;
this.index = this.index + this.load_once;
_.each(users, function(user){
that.addOne(user);
});
},
addOne: function(user){
var view = new UserView({model: user});
this.$("#user_list").append(view.render().el);
}
你能告訴我們'this.more'的內容嗎? –
問題已更新。 – kapeels
在我的'initialize',我調用'this.collection.fetch()'的地方,我傳遞了一個'success'選項的函數。這對我有用。 – kapeels