0
votes

I currently have a composite view which renders a table of models. I have the thead in the composite view template and each model is rendered using the itemViewTemplate.

What I want to do is render a tfoot after the models, can the composite view do this? Would I have bind to the onrender and append another template to the end of the composite view?

1
Do you need use any of your model/collection data for tfoot?Will M
Why not have a Layout which contains your CompositeView in a region above the footer?Scott
Will, yes I need to use some collection data. Going to try Chris's answer below as thatAndrewHumphreys

1 Answers

0
votes

Absolutely.

var Row = Backbone.Marionette.ItemView;

var Table = Backbone.Marionette.CompositeView.extend({
    template: /* resolves to: */ '<table><thead> {{header row}} </thead>' +
                                 '<tbody></tbody>' +
                                 '<tfoot> {{footer row}} </tfoot>',
    itemView: Row,
    itemViewContainer: 'tbody'
});