I used the Backbone LayoutManager to manage my views in the application. I wanted to try a puppet. I ran into a problem when I could not add a view to the area.
HTML
<body> <div id="content"> <header id="header"></header> <div id="wrapper"> <span>Some View Content</span> </div> <footer id="footer"></footer> </div> </body>
App.js
MyApp = new Backbone.Marionette.Application(); var rm = new Marionette.RegionManager(); var regions = rm.addRegions({ mainRegion : '#content', headerRegion : '#header', wrapperRegion : '#wrapper', footerRegion : '#footer' }); regions.headerRegion.show(new HeaderView()); regions.wrapperRegion.show(new SomeView()); regions.footerRegion.show(new FooterView());
If I want to add another view to wrapperRegion, how do I do this?
I also wanted to know if there is a way to insert another view into my existing view? The layout manager allowed me to write the code below. How can I achieve something like this in a puppet?
var MyView = Backbone.View.extend({ tagName: "div", beforeRender: function() { this.insertView(new ItemView()); } });
user1184100
source share