mercredi 5 juillet 2017

Ember: Edit model object without setting isdirty

This topic har been discussed on stackoverflow before, but not with latest version of ember data, I think. At least none of the suggestions I have found have worked for me.

I use the latest version of Ember and Ember data (versjon 2.13.0). I use the JsonApiAdapter.

Scenario

After I load an record from the server I want to do a few changes to some of its properties. These changes shall not make the record dirty, and the changed attributes shall not show up in the record.changedAttributes(). Any changes the user may do after that shall make the record dirty.

Searching for a solution

I have tried to manually change the isDirty flag, but it didn't do it. I have also tried to find the place in the ember data code that sets the state after a record has been loaded (because essentially I am trying to do the same thing) but I haven't found where it is. I have also tried record.send('pushedData'), but I didn't change anything of the state of the record.

Any help appreciated.




Aucun commentaire:

Enregistrer un commentaire