user2503775
user2503775

Reputation: 4367

backbone marionette cancel all events on itemview - at once

I have a table - compositeView, with rows - itemView. Each row has many events - click, change and more.

In certain state, I would like to 'lock' the table. disable buttons and cancel events.

Is there a nice way to cancel all events on itemview - at once?

Upvotes: 1

Views: 133

Answers (2)

Benjamin Craig Adams
Benjamin Craig Adams

Reputation: 81

I would keep a variable in the intialize function of the view to something along the lines of this.canWeDoEvents = true. Then inside of each event function do a check on

someClickEvent: function(){

  if(this.canWeDoEvents===true)
  {
 //doevent
  }
}

Upvotes: 0

Simon
Simon

Reputation: 1755

I presume you're talking about the jQuery events created with Backbone's events hash. You can remove them by calling undelegateEvents on Backbone.view.

Upvotes: 1

Related Questions