I'm listing a hasMany
relationship, of which a record can be updated, deleted or added.
I want to provide the user with a revert option, which should revert the list to its last saved state.
For deletion, I do item.deleteRecord()
, so that I can revert the changes using rollbackAttributes()
. Changes are reverted as expected, but it behaves inconsistently while saving (saving the model to which the items belong doesn't update its dirty state on first save, next record disappears from the view though the changes sent to the back-end properly, and so on).
So I decided to use unloadRecord
, but once a record is unloaded, I'm unable to revert it without reloading the page.
One way would be to save the old state and use it on revert. Please help me with a cleaner to achieve this.
For an idea of my model, Ember: Model's property changes not detected in computed property
deleteRecord()
andsave()
.unloadRecord()
is not the right feature for what you are trying to achieve. Feel free to open another question for your original feature and ping me. Would be helpful if you include API response. – jelhan