Marionette does not provide a way to do this using the standard API, but it is possible to use some internal CollectionViewMarionette methods . I gave an example here:
http://jsbin.com/zirupeli/1/edit
The key part is the function createChildrenin CollectionView:
var List = Marionette.CollectionView.extend({
el: 'ul',
itemView: Item,
initialize: function() {
this.createChildren();
},
createChildren: function() {
this.collection.each(function(model) {
var view = new this.itemView({
el: 'li:eq(' + (model.get('id') - 1) + ')',
model: model
});
this.addChildViewEventForwarding(view);
this.children.add(view);
}, this);
}
});
ItemView , Marionette CollectionView: this.addChildViewEventForwarding this.children.add. , :
https://github.com/marionettejs/backbone.marionette/blob/master/lib/backbone.marionette.js#L1687
, , , , .