[Edit Mode] Added ability to clear all dirty cache

This commit is contained in:
Henry 2016-02-09 19:29:55 -08:00
parent 0a5097a945
commit 668c02f278
2 changed files with 9 additions and 2 deletions

View File

@ -125,7 +125,7 @@ define(
EditorCapability.prototype.cancel = function () {
this.editableObject.getCapability("status").set("editing", false);
//TODO: Reset the cache as well here.
this.cache.markClean(this.editableObject);
this.cache.markClean();
return resolvePromise(undefined);
};

View File

@ -126,7 +126,14 @@ define(
* @param {DomainObject} domainObject the domain object
*/
EditableDomainObjectCache.prototype.markClean = function (domainObject) {
delete this.dirtyObjects[domainObject.getId()];
var self = this;
if (!domainObject) {
Object.keys(this.dirtyObjects).forEach(function(key) {
delete self.dirtyObjects[key];
});
} else {
delete this.dirtyObjects[domainObject.getId()];
}
};
/**