minasmart / backbone-editable

An editable field mixin for backbone views
11 stars 7 forks source link

event triggered on success? #2

Open dgdosen opened 12 years ago

dgdosen commented 12 years ago

Is there an event tiggered on success? I have a nested view, and need to update something on an outer view when this view's model is successfully updated...

I thought blur would work, but it still holds the updated values when the event is triggered...

minasmart commented 12 years ago

Backbone models fire an event when successfully updated. They fire a sync event: http://backbonejs.org/#FAQ-events

    "sync" (model, collection) — triggers whenever a model has been successfully synced to the server.
dgdosen commented 12 years ago

here's the issue with that - backbone sends back a success - which I can grab, but I don't have any of the new values. Those are in the model in backbone-editable. I need/want a quick way to get at the edited (and now saved) data.

any thoughts?

minasmart commented 12 years ago

if you're watching the sync event, the model is the first argument to your callback and it will have the now changed data. Is that not what you're looking for?