Patrick Wolf
Patrick Wolf

Reputation: 1319

Backbone Marionette Layout and Region (which comes first?)

I've read the docs on layouts and regions, however I'm struggling to understand which one is at the top level. I'm starting on my initial application which will have a few core structural layouts. The question becomes, do I create a main container region and attach layouts per core structural layout (which would then have sub regions for widgets, etc )? Or do I create a layout which creates the main DOM element that can be switched out at the top. I guess I'm having an issue understanding in the sense of which comes first, the chicken or the egg or in the scope of marionette layouts and regions. I would assume a region given that a layout is basically an item view and item views are typically attached to a region.

In short, can I start my initial application with a layout which then has regions and sub layouts, etc? Or should I start my application with a main region which then has sub layouts and regions.

Upvotes: 2

Views: 181

Answers (1)

Patrick Wolf
Patrick Wolf

Reputation: 1319

After a bit more googling, I think the answer has become clear. I first need to create a region where layouts can be added to. This is further described at http://davidsulc.com/blog/2012/05/06/tutorial-a-full-backbone-marionette-application-part-1/.

In my use case I would create a main container region which other layouts can be added to. Those layouts could then have sub regions and those sub regions could have layouts, thus infinitely expanding.

Upvotes: 2

Related Questions