Tuesday, 10 September 2013

How to get "isDirty" flag in Epf (Ember Persistence Foundation) to reset after flush or refresh?

How to get "isDirty" flag in Epf (Ember Persistence Foundation) to reset
after flush or refresh?

I'm using Epf in a new project, and have set up my model as so:
Etst.Persona = Ep.Model.extend
name: Ep.attr 'string'
age: Ep.attr 'number'
favorite_food: Ep.attr 'string'
isClean: ( ->
! @get("isDirty")
).property("name", "age", "favorite_food")
I need the "isClean" rather than straight "isDirty" to make a disabled
button show up only when the model is dirty.
I find that when I change any field through an Ember.TextField it changes
perfectly.
However, I find that after I do either a call to flush() or refresh(), the
model in memory does NOT have its "isDirty" flag cleared, even though it's
been successfully saved or reloaded.
Thanks!

No comments:

Post a Comment