If I have done my homework correctly, I have come to learn that Backbone does not have built-in save event that is triggered when a model is saved using the model’s save method (even though there is a destroy event).
I have also learned that Backbone has a nifty mechanism for creating custom events using the Backbone.Events object. Using the latter works, but I have the impression that it is not fine-grained enough for my needs.
My setup is as follows. I have a table (view) built up of rows (views) with each row having a reference to a model. When the model is saved, I’d like to update/render the row to reflect the changes.
How does one go about creating a save event that is triggered when a model is saved so that the table row (view) that has a reference to that model is updated?
In other words, I’d like to be able to do the following:
this.model.bind('save', this.render);
Just 3 days ago, a commit was made to Backbone that triggers a
syncevent when the model is successfully saved. This commit hasn’t been release yet, though, so you will need to download the source code from the github account if you want to use it.