ember.js - Reset isDirty-flag -
i have 2 models:
// subject export default ds.model.extend({ willbeactive: ds.attr('boolean') }) // studyplan export default ds.model.extend({ name: ds.attr('string'), subjects: ds.hasmany('subjects'), havachanges: function(){ var isdirty = this.get('isdirty'), subjectsdirty = this.get('subjects').isany('isdirty', true); return subjectsdirty || isdirty; }.property('isdirty', 'subjects.@each.isdirty') })
i use embeddedrecordsmixin
, activemodeladapter
embed inside studyplan payload subjects
have changed, when promise resolved isdirty
flag of each subject remains in true
. can reset isdirty
flag of each subject
after saving studyplan
?
you might interested in this package
it marks parent dirty when child record dirty , clears isdirty field on child records when parent saved.
Comments
Post a Comment