Skip to content

Instantly share code, notes, and snippets.

@bu1ka
Last active August 29, 2015 14:04
Show Gist options
  • Save bu1ka/03bcdd9ef5a25b245f81 to your computer and use it in GitHub Desktop.
Save bu1ka/03bcdd9ef5a25b245f81 to your computer and use it in GitHub Desktop.
var Engines = Backbone.Collection.extend({
model: FilterItem,
initialize: function() {
this.on('change:selected', this.toggleSelected, this);
},
toggleSelected: function(model) {
if (model.changed.selected) {
this.without(model).forEach(function(unSelectedModel) {
unSelectedModel.set('selected', false);
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment