Given a model parent, that hasMany childs.
How can I track deleted childs? If ember keeps track of them, how I access them?
I have a complex form, where user can add/edit/delete childs, but we have only one place to persists/cancel the parent. Is in this place where we persist/rollback also the childs.
I can manually keep track of deleted records, but if Ember keeps track of them, I prefer to use ED ;-)
I'm playing with something like that, but it's not working:
dirtyTasks: Ember.computed.filterBy('model.childs.@each.content', 'isDirty', true),
deletedTasks: Ember.computed.filterBy('model.childs.@each.content', 'isDeleted', true),
changedTasks: Ember.computed.union('dirtyTasks', 'deletedTasks'),
dirtyTasks: Ember.computed.filterBy('model.childs.@each', 'isDirty', true),
deletedTasks: Ember.computed.filterBy('model.childs.@each', 'isDeleted', true),
changedTasks: Ember.computed.union('dirtyTasks', 'deletedTasks'),
dirtyTasks: Ember.computed.filterBy('model.childs.[]', 'isDirty', true),
deletedTasks: Ember.computed.filterBy('model.childs.[]', 'isDeleted', true),
changedTasks: Ember.computed.union('dirtyTasks', 'deletedTasks'),
Also, in the inspector, I can see the content.canonicalState, content.currentState, wich are arrays with the rows, but sure there is an easier way like: model.get('childs.deletedRecords') or something similar ?
thanks
Same question but it's not clear to me how to solve it
Aucun commentaire:
Enregistrer un commentaire