Commit 3ee32a9f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

clear button fixed to clear search results

parent 26d71277
......@@ -362,6 +362,8 @@ ServerConnector.sendClearRequest = function(overlayName) {
} else {
logger.warn("Clear function for " + overlayName + " doesn't exist");
}
} else if (overlayName==="search" || overlayName==="comment"){
logger.warn("Send clear request for overlay that doesn't support it: "+overlayName);
} else {
throw new Error("[Clear function] Unknown overlay: ", overlayName);
}
......
......@@ -196,7 +196,11 @@ CustomMap.prototype.clearOverlays = function() {
for ( var overlayName in this.overlayCollections) {
if (this.overlayCollections.hasOwnProperty(overlayName)) {
var collection = this.overlayCollections[overlayName];
this.clearOverlayCollection(collection);
if (collection.constructor.name==="OverlayCollection") {
this.clearOverlayCollection(collection);
}else {
collection.clear();
}
}
}
};
......
......@@ -235,6 +235,8 @@ SearchDbOverlay.prototype.searchByEncodedQuery = function(originalQuery, perfect
}
};
SearchDbOverlay.prototype.clear = function() {
return this.searchByQuery("");
};
module.exports = SearchDbOverlay;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment