I have this mixin that is used by many views
var EditTableRowMixin = {
events: {
"click .save": "save",
"click .abort": "abort"
},
/* common methods for table rows */
};
Now I have a new view that needs a couple more events than this mixin has:
var SpecialRowEditView = Backbone.View.extend({
tagName : "div",
events: {
"click .remove" : "remove",
"click .add" : "add"
},
initialize: function(){
/*Do things */
},
...
...
...
});
_.extend(SpecialRowEditView.prototype, EditTableRowMixin);
return SpecialRowEditView;
I have tried to just add these events to this.events (which is the mixins events). It works, but breaks all the other views using the mixin because those now look for the save and abort functions for some reason.
How can I extend the mixin's events with the ones I need for this view only?