function identificationTool(action,qryUE,queryTaskUE) { alert(action); if(action =="go") { dojo.connect(map, "onClick", function(evt) { console.log("Identification: click"); //onClick event returns the evt point where the user clicked on the map. //This is contains the mapPoint (esri.geometry.point) and the screenPoint (pixel xy where the user clicked). //set query geometry = to evt.mapPoint Geometry qryUE.geometry = evt.mapPoint; //Execute task and call showResults on completion queryTaskUE.execute(qryUE, showResults); }); } else { dojo.connect(map, "onClick", function(evt) { // Here we should stop the execution of the queryTaskUE map.infoWindow.hide(); }); } }
Solved! Go to Solution.
I'm glad that you're happy 🙂
But...and I've misunderstood the solution you've been given...but I don't think I agree with it, normally you'd wouldn't have to keep clicking the identify button repeatedly in a GIS app to perform multiple serial identify requests.
For example, think about ArcMap - you put the application in identify mode then just keep clicking on the map as many times as you like, you don't have to re-click the identify button in the toolbar between map clicks.
Maybe I misunderstood you aim all along...
function init() { ... $(document).ready(function() { toolAction(map,qryUE,queryTaskUE); }); } function toolAction(map,qryUE,queryTaskUE) { ... $("#identify_spot").bind("click", function(event) { // If it's the same tool if( getActiveTool() == "#identify_spot" ) { setActiveTool(); // Clear all the graphics, but not the infoTemplate and I don't know why. map.graphics.clear(); dojo.disconnect(getDojoClick()); } // If it's the not same tool else { setActiveTool("#identify_spot"); setDojoClick(dojo.connect(map, "onClick", function(evt) { identificationTool(qryUE,queryTaskUE,evt); console.log("identification click"); }) ); } }); } var thisTool; var dojoAction; function setActiveTool(tool) { if(tool != null) { thisTool = tool; $(thisTool).addClass("active_tool"); } else { $(thisTool).removeClass("active_tool"); thisTool = ""; } console.log(thisTool+" class=active_tool") } function getActiveTool() { return thisTool; } function setDojoClick(action) { if( action != null ) { dojoAction = action; } else { dojoAction = "vide"; } } function getDojoClick() { console.log("kill"); return dojoAction; }