Ember.data 2.2.0
The state of just created object is dirty (get('hasDirtyAttributes' return true), cause the new ID is set every time.
I need to know when the record is created, not saved and the "user" not modified it. So, I can't use the dirty state cause the store change it.
If I modified the internal state just after create the record, I will broke somthing inner the record?
My real need, is when I create the record I need a initiale state and I want detect when a user change it. So, I saw in the record source code, it's use the "setProperties" methode to set the ID and optionaly the data passed to the createRecord method.
So, I want override the createRecord store metod to set the dirty state to false after created it. And the principal, how I can do that?
I saw the doc of DS.RootState Class and it just talk about that states : (deleted, saved, uncommitted, inFlight, empty, loaded, created, updated, loading) and the method translateTo but nothing to change the dirty state.
In the doc say :
Flags are Boolean values that can be used to introspect a record's current state in a more user-friendly way than examining its state path
So... I set currentState.parentState.isDirty to false and that it!
Aucun commentaire:
Enregistrer un commentaire