App.modalRegion
を表示する領域TopicView
、講義リンクのリストを表示する CompositeView、sidebar
およびcontent
リンクをクリックすると講義ビデオを再生する領域があります。すべて正常に動作しますが、VideoItemView
別のリンクをクリックしても閉じません。
私の質問は: クリックでビデオ コンテンツが変更された場合、サブリージョンとリージョン内のレイアウトを使用せずに前のコンテンツを閉じることができるかどうか'.link'
(マリオネットの魔法の方法の 1 つ) はありますか? コードは次のとおりです。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
);
}
});