Created
March 11, 2016 15:08
-
-
Save julesbou/27d6fde9f80085abe30c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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