【发布时间】:2014-02-07 15:30:13
【问题描述】:
我有一个 Backbone Marionette CollectonView,它正在其子视图中监听事件,如下所示:
this.on(this, 'itemview:timeline:storyRemoved', this._storyRemoved);
itemview 在其 onClose 期间触发事件:
onClose: function () {
this.trigger('timeline:storyRemoved', { model: this.model });
}
但 _storyRemoved 函数从未被调用。
如果我将触发器移到 onShow 则它工作正常:
onShow: function () {
this.trigger('timeline:storyRemoved', { model: this.model });
}
我猜这与视图已关闭因此不再位于集合视图中的事实有关?
有什么办法让它工作吗?
【问题讨论】: