I'm using backbone.js and rails. When backbone.js saves a model for the first time rails responds with the new id and backbone.js does a set on the model with the new id.
http://documentcloud.github.com/backbone/docs/backbone.html#section-41
My problem is I can't make that set be silent. That set calls a change event which causes my view to render.
js Event once() The event once method is just like event on method but it causes the bound callback to only fire once before being removed.
Backbone. js is a model view controller (MVC) Web application framework that provides structure to JavaScript-heavy applications. This is done by supplying models with custom events and key-value binding, views using declarative event handling and collections with a rich application programming interface (API).
Backbone. Backbone has been around for a long time, but it's still under steady and regular development. It's a good choice if you want a flexible JavaScript framework with a simple model for representing data and getting it into views.
You can pass an option in the save method to not trigger any events
model.save(null, { silent: true })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With