0

我的问题是,当我们绑定/监听集合的添加事件时,有没有办法检测从集合中删除的模型。

例如:

this.listenTo(monthsOnBoardCollection, "remove", function(){
  //is it possible here to find what got removed from the collection ? 
}
4

1 回答 1

2

You have the Catalog of Events which shows the arguments being passes to the event.

"remove" (model, collection, options) — when a model is removed from a collection.

So it's basically:

this.listenTo(monthsOnBoardCollection, "remove", function(model, collection, options){
  //now you have the model, the collection and the options which were passed to the remove method
}
于 2013-04-01T18:22:07.937 回答