So after a couple days of experimenting, completely leaving this approach for another(Does a CollectionView's childView have to be an ItemView?) and then returning to it. I feel as though I have figured it out.
This approach is for nesting multiple MarionetteView under a collection/composite view, so lets use an example of a Column that could have any number of panels
First we create a collection of views for the column
//These exist in the view...
class PanelView1 extends Marionette.CompositeView
...
class PanelView2 extends Marionette.ItemView
...
columnPanelCollection = new ColumnPanelCollection([
index: 1, view: PanelView1, data: dataForPanelView1Collection
,
index: 2, view: PanelView2 , data: null
])
So we create a collection for the column (columnPanelCollection ), passing the type, not instance, of the MarionetteView, so PanelView1 and PanelView2, into the 'view:' attribute. Also pass any data that view may need in a collection in the 'data': attribute
Now we put the collection we just created into a CollectionView
columnCollectionView= new ColumnCollectionView(
collection: columnPanelCollection
)
in the ColumnCollectionView class, we use the callback
getChildView:(model)->
return model.get('view')
and we return the 'view:' attribute which is the Type of View we want created, this will create a child view based on that type. Then in the childView's class (so PanelView1 or PanelView2 class) we can use the onShow callback and set up a collection for that view based on the 'data:' attribute we provided
class PanelView1 extends Marionette.CompositeView
...
template: ....
collection: new PanelDataCollection()
onShow:(view)->
modelCollection = view.model.get("data").models
@collection.reset(modelCollection) if modelCollection
sidenote: a collection attribute must still be specified in the PanelView class, this is why I initialize it as a 'new PanelDataCollection()', and then set it onShow
We can then use a LayoutView and put the columnCollectionView into one of the regions and show it.