Skip to content

Commit ba4ddbc

Browse files
committedDec 1, 2014
Make views listen to reset event
1 parent 2054ea2 commit ba4ddbc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ either.
2525

2626

2727
I decided to put an end to this experiment and leave the MarionetteJS version.
28-
[Click here for a demo](https://hernantz.github.com/masuno)
28+
[Click here for a demo](https://hernantz.github.com/masuno/)

‎app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ $(function () {
7272
el: '#thingstable',
7373
template: '#thingstable-tpl',
7474
events: {'click .btn-machi': 'add'},
75-
collectionEvents: {'change': 'setTotal', 'remove': 'render'},
75+
collectionEvents: {'change': 'setTotal', 'reset remove': 'render'},
7676
setTotal: function () { this.$('.total').text(this.collection.total()); },
7777
add: function () { this.collection.add({}); },
7878
onRender: function () { this.setTotal(); }
@@ -86,7 +86,7 @@ $(function () {
8686
template: '#ppltable-tpl',
8787
events: {'click .btn-machi': 'add'},
8888
collectionEvents: {'remove change': 'render'},
89-
initialize: function () { this.listenTo(App.things, 'add change remove', this.render); },
89+
initialize: function () { this.listenTo(App.things, 'reset add change remove', this.render); },
9090
setTotal: function () { this.$('.total').text(this.collection.total()); },
9191
add: function () { this.collection.add({}); },
9292
serializeData: function () { return _.extend({ things: App.things }, this.collection.toJSON()); },

0 commit comments

Comments
 (0)