Kinergy
Kinergy

Reputation: 345

Multiple Marionette CollectionViews in a CompositeView

I'd like to create a view with Backbone.Marionette that renders a model and then maintains 2 or more CollectionViews. Basically a CompositeView with more than one CollectionView - I'm new to using Marionette, any recommendations on what the best approach would be here?

Thanks!

Upvotes: 2

Views: 1329

Answers (1)

danikoren
danikoren

Reputation: 4301

you can use a layout to hold and manage your 2 collection views. the main layout will render its own model and template, create the 2 sub views (collectionView or CompositeView).

  AppLayout = Backbone.Marionette.Layout.extend({
  template: "#layout-template",

  regions: {
    collection1: "#collection1",
    collection2: "#collection2"
  }
});

var layout = new AppLayout();
layout.collection1.show(new collection1()); 
layout.collection2.show(new collection2()); 

Upvotes: 7

Related Questions