I am showing a table view using Marionette's composite view. The composite view's template has a tbody with an initial which shows a loadding animation gif.
Now, when the render method is called, I want to remove this initial row and then append the results of collection fetch. However the default render implementation of Marionette seems to be appending to the tbody.
My item template for item view:
<td><input type="checkbox" class="checkboxContact" id="<%-id %>"/></td>
<td><%-name %></td>
<td> <%-msisdn %></td>
<td> <%-email %></td>
<!--
<td> <%-address %></td>
<td> <%-last_modified_time %></td>-->
<td>
<i rel="tooltip" class="fa fa-pencil-square-o actions" id="editIcon" title="edit"></i>
<i rel="tooltip" class="fa fa-trash-o actions" title="delete"></i>
</td>
The overridden render method, as below.
render: function() {
if (this.collection.size() <= 0) return;
this.$el.html(this.template((this.collection.toJSON()));
return this;
}
I also tried
render: function() {
if (this.collection.size() <= 0) return;
this.$el.html(this.template({
collection: this.collection.toJSON()
}));
return this;
}
None of these work.