After reading the comments, I think I already understand how I can help with your problem:
In your code, both views listen on the same global event, so both of them will respond simultaneously, and you want to be able to run selected() each view independently.
The usual approach for this is that the view is associated with the model, and the view listens for events on this model, so the events that are triggered for one model only affect the views associated with it.
This template is as follows:
// code simplified and not tested var MyView = Backbone.View.extend({ initialize: function( opts ){ this.model = opts.model; this.model.on( "selected", this.selected, this ); }, selected: function( model ){ // ... } }) var oneModel = new MyModel(); var oneView = new MyView({ model: oneModel });
Now you only need to take care of triggering the selected event for each model when necessary.
Update
This template is so common that Backbone links the View.model link for you, so you can implement your View.initialize as follows:
initialize: function(){ this.model.on( "selected", this.selected, this ); }
fguillen
source share