I recently discovered something rather annoying about ExtJS Stores.
You may know that you can request all of the modified Records from a Store with something like:
var arr_modified = obj_store.getModifiedRecords();
This can be very useful if you have a lot of Records but only want to perform actions on the ones that have been edited by the user.
However, what I didn't realise is that the modified Records are held separately so that if you empty the Store (by calling removeAll()) and repopulate it then call getModifedRecords() again not only do you get any modified Records from the new batch but from the old batch also.
The remedy to this is quite simple, upon emptying the Store you must also call rejectChanges() which clears the cache of changed Records (this is complimentary to commitChanges() which performs basically the same action but for a different reason).
No comments:
Post a Comment