Skip to content

Instantly share code, notes, and snippets.

@itokami1123dev
Created July 24, 2013 08:38
Show Gist options
  • Save itokami1123dev/6068939 to your computer and use it in GitHub Desktop.
Save itokami1123dev/6068939 to your computer and use it in GitHub Desktop.
var SumPriceView = Backbone.View.extend({
el: '#sum-price-pane',
collection: null, // :MenuList
template: null, // :_.template(x)
initialize: function(options){
this.listenTo( this.collection, 'change', this.render);
this.template = _.template( $('#' + this.el.id + '-template').html() );
this.render();
},
render: function(){
var menuList = this.collection;
var sumPrice = menuList.sumPrice();
var html = this.template( { sumPrice: sumPrice } );
this.$el.empty()
.html( html );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment