我有一个由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);
答案 0 :(得分:4)
覆盖initialEvents
方法。
var ActiveWordView = M.ItemView.extend({
template: '#active-word-template',
tagName: 'form',
initialEvents: function() {},
});