I have a permanent data store . I want to clone the records to a temporary data store,make changes to the records and then copy the modified records back to the permanent store.
I created the temporary store like this:-
permanentStore.each(function (record) {
temporaryStore.add(record.copy());}
);
How do I copy back only the modified records ? Do I need to find the matching records using id for all the modified records or is there any other easy way?
permanentStore.findRecord('Id','temporaryStoreRecordId')
Is there any clean way of cloning so that the changes are applied to the permanent store automatically ?
You can use
clonemethod to clone allrecords.var clonerecord = Ext.clone(records);temporaryStore.add(cloneRecord);temporaryStore.getModifiedRecords();to get modified records.temporaryStore.getNewRecords();to get new records.temporaryStore.getRemovedRecords();to get remove records.