0
我有一個區域App.modalRegion
,我展示TopicView
,一個CompositeView中,顯示在sidebar
講座鏈接,並點擊一個鏈接時播放講座視頻content
區域的列表。一切工作正常,但VideoItemView
未被關閉,當另一個鏈接被點擊。關閉ItemView控件不提線木偶的RegionManager
我的問題是:當視頻內容在'.link'
點擊改變,有沒有(這些木偶的神奇方式中的一種)以前VideoItemView
可以被關閉不使用App.modalRegion
區域內的子區域和佈局。下面的代碼:
App.modalRegion.show(new TopicView({ model: topicModel }));
TopicView = new Backbone.Marionette.CompositeView.extend({
template: tpls.TopicTpl,
ui: {
sidebar: "#topic-sidebar",
content: "#topic-content"
},
initialize: function(){
this.listenTo(this.model, "change", this.render);
},
onRender: function(){
this.showContent();
var collection = this.model.get('lectures'),
that = this;
this.ui.sidebar.on('click','.link',function(e) {
e.preventDefault();
var sno = $(this).data("sno");
var vid = new VideoItemView({
model: collection.get(sno),
lec_sno: sno
});
that.ui.content.html(
vid.render().el
);
});
},
showContent : function() {
var list = new LectListCol({
collection: this.model.get('lectures')
});
this.ui.sidebar.html(
list.render().el
);
}
});