0

I have a collection which is rendered by a Backbone Marionette item view. The view is being re-rendered whenever the collection is reset. As far as I can work out, that is default Backbone.Marionette behaviour. Is there a way I can disable it?

  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);
David Tuite
  • 22,258
  • 25
  • 106
  • 176

1 Answers1

4

Override the initialEvents method.

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

  initialEvents: function() {},
});
David Tuite
  • 22,258
  • 25
  • 106
  • 176
  • i was just about to hit "post" on my answer when this came through. exactly what i was going to say :) – Derick Bailey Jul 24 '12 at 15:14
  • Just as I finished typing the question I thought "I should probably have a look at the source". Found the answer 2 minutes later, clear as day. – David Tuite Jul 24 '12 at 15:45