From a8c17c0d5596deca923812622b4fc262c67f0121 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Tue, 25 Jul 2017 16:54:54 +0200 Subject: [PATCH] when clicking on drug last drug name was used (not the current) --- .../main/js/map/window/AbstractInfoWindow.js | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/frontend-js/src/main/js/map/window/AbstractInfoWindow.js b/frontend-js/src/main/js/map/window/AbstractInfoWindow.js index b7d7608b18..d194c3e1d4 100644 --- a/frontend-js/src/main/js/map/window/AbstractInfoWindow.js +++ b/frontend-js/src/main/js/map/window/AbstractInfoWindow.js @@ -32,19 +32,17 @@ function AbstractInfoWindow(params) { var onOverlayFullViewChanged = function(e) { var self = e.object; // first change the content of the element - return self.update().then( - function() { - if (e.newVal) { - var element = new IdentifiedElement({ - objectId : self.getElementId(), - modelId : self.getCustomMap().getId(), - type : self.getElementType() - }); - - return self.getCustomMap().getTopMap().retrieveOverlayDetailDataForElement(element, - self.getOverlayFullViewArray()); - } + return self.update().then(function() { + if (e.newVal) { + var element = new IdentifiedElement({ + objectId : self.getElementId(), + modelId : self.getCustomMap().getId(), + type : self.getElementType() }); + var topMap = self.getCustomMap().getTopMap(); + return topMap.retrieveOverlayDetailDataForElement(element, self.getOverlayFullViewArray()); + } + }); }; @@ -480,6 +478,11 @@ AbstractInfoWindow.prototype._createTableForTargetDiv = function(data, overlay) table.appendChild(header); var row; + var onclick = function() { + // ';' enforces single query (in case there are ',' characters in the name) + return overlay.searchByQuery(this.innerHTML + ";"); + }; + var count = 0; for ( var searchId in data) { if (data.hasOwnProperty(searchId)) { @@ -501,9 +504,7 @@ AbstractInfoWindow.prototype._createTableForTargetDiv = function(data, overlay) } var link = Functions.createElement({ type : "a", - onclick : function(drug) { - return overlay.searchByQuery(nameContent); - }, + onclick : onclick, href : "#", content : nameContent, }); -- GitLab