derickbailey/backbone.marionette — Issue #35: Build a CompositeRegion object, to help with nested views and nested regions
Author: derickbailey
Created: 2012-02-29 14:30:59+00:00
State: open

i have this idea to help make your original problem easier, and to help make nested views easier… i'm thinking about creating something like a CompositeRegion that encapsulates rendering some HTML in to a screen and creating / holding on to region managers within that rendered HTML. I'm not sure if it should use a View to render the HTML, or if it should just encapsulate the rendering itself. I'm leaning toward encapsulating the rendering, itself, but using the same basic API as a view, so that it can be dropped in as a view replacement when needed. Something like this, maybe:

```html

```

```js
var CompReg = Backbone.Marionette.CompositeRegion.extend({
template: "#some-region-template",

regions: {
menuRegion: "#menu-list",
mainRegion: "#main-content"
}
});
```

then you could create it and pass it to an existing region manager to show it, and use the composite region to show sub-views:

```js
var compReg = new CompReg();
MyApp.contentRegion.show(compReg);

compReg.mainRegion.show(new SubApplicationContentView());
compReg.menuRegion.show(new SubApplicationMenuView());
```