0

我有一个由 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);
4

1 回答 1

4

覆盖initialEvents方法。

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

  initialEvents: function() {},
});
于 2012-07-24T15:13:32.923 回答