2013-04-01 47 views
0

我的问题是从集合中删除的模式,是有办法来检测得到了从集合中删除时,我们绑定/听集合的add事件模型。删除事件来检测Backbone.js的

为前:

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

回答

2

你有Catalog of Events,显示的参数被传递给事件。

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

所以它基本上是:

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 
} 
+0

这会有所帮助。非常感谢 – digToGetWater