I'm using a composite view to display a table with Backbone Marionette, but having some trouble getting the wrapper part of the template to rerender when the data comes in after I do a fetch on my model. Here are my templates:
The composite view's template:
<thead>
<tr>
{{#each report.columns}}
<th>{{name}}</th>
{{/each}}
</tr>
</thead>
<tbody></tbody>
And the ItemView's template:
{{#each cols}} <td>{{value}}</td> {{/each}}
In my controller function, I'm creating the instance of the model, creating and showing the view, and doing a fetch to get my data into the model:
var tView = new tableCompositeView({collection: rowsCollection, model: configModel});
layoutView.tablecontent.show(tView);
rowsCollection.fetch();
configModel.fetch();
The collection items come in fine, the view is updated when the fetch is successful. The wrapper bit in the composite view's template never gets updated when the configModel.fetch() finishes, though.
In the docs, it says you can use .renderModel() to re render only the parts of the view that deal with the model. When I do this:
configModel.fetch().success(function(){ tView.renderModel(); });
Nothing changes. But when I use .render():
configModel.fetch().success(function(){ tView.render(); });
It works fine and gets updated. This could work for now, but it's rerendering my entire table which could be kind of a performance issue