F
F
fsamorodov2016-10-05 10:11:40
Ember.js
fsamorodov, 2016-10-05 10:11:40

How to get .isDirty or .hasDirtyAttributes to work correctly in Ember.js when working with hasMany and belongsTo?

Hello!
The form has a save button. It will disable if there are no changes in the form and the model is clean. In theory, by adding hasMany or belongsTo to the model, we need to unlock the button, but the .isDirty and .hasDirtyAttributes methods do not see model changes.
Is there any way out of the situation? There are quite a lot of such buttons on the application, if there was one, they would have been nailed somehow :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Romanov, 2016-10-05
@Kaer_Morchen

Yes, it's an old ember-data issue, rollback doesn't work with hasMany or belongsTo either, the last thread about it is here .
You can fix this case manually by calling model.send('becomeDirty')after changing the links

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question