Search code examples
backbone.jscollections

is there a way to find out which model instance in collection is changed?


I am new to BackBone. I know Collection can listen to model attribute changes, but is there a way to find out which model instance is changed? I know it may be a dumb question...but I cant find the answer..Thank you in advance.


Solution

  • you can bind an event on your model of collection for achieving this

    var myModel = Backbone.Model.Extend({
    
     initialize : function(){
      this.on("change",this.callThisFunction)
    },
    
    callThisFunction : function(changedModel){
    
      }
    });