Skip to content

Commit

Permalink
support for prepending the totals row
Browse files Browse the repository at this point in the history
  • Loading branch information
esseguin committed Sep 9, 2014
1 parent e5b9596 commit 56c855a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion backgrid-sum.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
var SummedColumnBody = window.Backgrid.SummedColumnBody = window.Backgrid.Body.extend({
formatter: Backgrid.StringFormatter,
template: _.template('<td class="<%= className %>"><%= sum %></td>'),
prepend: false,

initialize: function () {
Backgrid.Body.prototype.initialize.apply(this, arguments);
Expand All @@ -81,7 +82,11 @@

render: function () {
window.Backgrid.Body.prototype.render.apply(this, arguments);
this.el.appendChild(this.getSumRow().render().el);
if (this.prepend) {
this.$el.prepend(this.getSumRow().render().el);
} else {
this.el.appendChild(this.getSumRow().render().el);
}
return this;
},

Expand Down

0 comments on commit 56c855a

Please sign in to comment.