You can use itemViewOptions either as an object or as a function
var TableView = Backbone.Marionette.CompositeView.extend({ template: '#table-template', itemView: TableRowView, itemViewContainer: 'tbody', itemViewOptions: { columns: SOMEOBJECTORVALUE } });
OR
var TableView = Backbone.Marionette.CompositeView.extend({ template: '#table-template', itemView: TableRowView, itemViewContainer: 'tbody', itemViewOptions: function(model,index){ return{ columns: SOMEOBJECTORVALUE } } });
and then get the following options:
var TableRowView = Backbone.Marionette.ItemView.extend({ tagName: 'tr', template: '#table-row-template', initialize: function(options){ this.columns = options.columns; } });
(* Note that itemView , itemViewContainer and itemViewOptions are changed in version 2 to childView , childViewContainer and childViewOptions ).
Scott
source share