Skip to content Skip to sidebar Skip to footer

Rendering Layouts And Sub-views In Marionette / Backbone.js

I have a working solution in regard to rendering layouts with views in regions in a Marionette application I'm working on, but something doesn't feel right about it. Do you have to

Solution 1:

Okay, so it seems like this can be circumvented by creating a 'region' in your application, then using .show() to show the layouts inside of it.

Here is a link to a fiddle I found on SO that helped: http://jsfiddle.net/TDqkj/6/

as well as to another question: Understanding layouts in Marionette for Backbone.js

The fiddle in particular has this code:

App = new Backbone.Marionette.Application();
App.addRegions({
   'nav': '#nav',
  'content': '#content'
});

Which the programmer than uses to add layouts to those regions -- meaning you never have to append to the DOM.

If anyone else has a more elegant solution, please post!

Post a Comment for "Rendering Layouts And Sub-views In Marionette / Backbone.js"