I have a root layout with two regions. One of them is simple ItemView, but another is LayoutView. When the second region try to show a LayoutView i receive an error
application.rootView.getRegion(...).show is not a function
in console. Can anyone help me to understand why this happening?
Views:
_RootView = Marionette.LayoutView.extend({
el: 'body',
regions: {
navigationRegion: {
selector: '.section-navigation',
regionClass: _NavigationRegion
},
contentLayout: {
selector: '.section-content',
regionClass: _ContentLayout
}
}
});
_ContentLayout = Marionette.LayoutView.extend({
template: '#content-template',
regions: {
contentRegion: {
selector: '.content',
regionClass: _ContentRegion
},
pagemasterRegion: {
selector: '.pagemaster',
regionClass: _PagemasterRegion
}
}
});
Application:
application = new _Application({
initialize: function (options) {
this.rootView = new _RootView();
}
});
application.on('start', function () {
var
contentLayout = new _ContentLayout();
var
navigation = new _Navigation();
navigation.fetch({
success: function (collection, response, options) {
var
navigationView = new _NavigationView({
collection: collection
});
//======Line without error=======
application.rootView
.getRegion('navigationRegion')
.show(navigationView);
}
});
//======Line with error=======
application.rootView
.getRegion('contentLayout')
.show(contentLayout);
});
application.start();