I have this event in my view:
events:
"click" : "clickContainer"
How can I unbind/bind (able and disable) temporary the click event in the same View?
I have this event in my view:
events:
"click" : "clickContainer"
How can I unbind/bind (able and disable) temporary the click event in the same View?
I would have a property on the view. Something like this:
var View = Marionette.ItemView.extend({
initialize: function() {
this.clickEnabled = true;
},
events: {
'click': 'clickContainer'
},
clickContainer: function() {
if ( this.clickEnabled ) {
// do stuff
}
}
});
then you just change that property when you want to change the state.
Another option is to remove the events map and use the manual version of what the events map sets up.