如何取消绑定默认视图事件绑定?

时间:2012-07-24 15:10:06

标签: backbone.js backbone-events marionette backbone-views

我有一个由Backbone Marionette项目视图渲染的集合。重置集合时,将重新呈现视图。据我所知,这是默认的Backbone.Marionette行为。有没有办法可以禁用它?

  var ActiveWordView = M.ItemView.extend({
    template: '#active-word-template',
    tagName: 'form',

    onRender: function() {
      // This is being triggered when the collection resets, even
      // though I didn't specify that behaviour in an initializer.
      console.log("Active word re-rendered");
    }
  });



  var activeWordView = new ActiveWordView({
    collection: this.model.get('words'),
  });
  this.activeWordRegion.show(activeWordView);

1 个答案:

答案 0 :(得分:4)

覆盖initialEvents方法。

var ActiveWordView = M.ItemView.extend({
  template: '#active-word-template',
  tagName: 'form',

  initialEvents: function() {},
});