Skip to main content
2 of 2
Put the code in a code block - last line wasn't being displayed

JS API Toggle Pop-Up On & Off

I am attempting to allow for the pop-up to be toggled on and off by pressing a checkbox. Here are some snippets of the code:

var clickHandler

function popupOn(evt){
var query = new esri.tasks.Query();
query.geometry = pointToExtent(map,evt.mapPoint,10);
var deferred = featureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW);
map.infoWindow.setFeatures([deferred]);
map.infoWindow.show(evt.mapPoint);
}

function clickConnect(connect){
if(connect){
//perform the identify task on click 
clickHandler = dojo.connect(map, "onClick", popupOn);
}
else{
//disconnect the click handler 
dojo.disconnect(clickHandler);
clickHandler = null;
}
}

<input type='checkbox' data-dojo-type="dijit.form.CheckBox" checked="checked" data-dojo-props="onClick: dojo.connect('true')"/><label>Tick here to turn selecting on.</label><br/>
jwx
  • 713
  • 1
  • 5
  • 19