Skip to content

Instantly share code, notes, and snippets.

@julesbou
Created March 11, 2016 15:08
Show Gist options
  • Save julesbou/27d6fde9f80085abe30c to your computer and use it in GitHub Desktop.
Save julesbou/27d6fde9f80085abe30c to your computer and use it in GitHub Desktop.
var View = Backbone.View.extend({
initialize: function() {
// when model is updated update the DOM
this.model.on('change', function(model, params) {
// remove ‘createdDate’, ‘id’, ‘updatedDate’ columns from changeset
var changeset = _.omit(params.changes, ['createdDate', 'id', 'updatedDate']);
if (changeset.status) {
this.updateStatus();
delete changeset.status;
}
if (_.size(changeset) > 0) {
this.render();
}
}.bind(this));
},
render: function() {
/* .. do rendering .. */
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment