Hi Jay,
Here is an example that sets the infoTemplate each time the button is clicked.
I am doing to below....I the map and nothing....the way I want it. I then click the button and then click a feature...it grabs the attrbiute info and displays in a pane on the left.The issue is that it allows the user to continue clicking in the map....I want to create this where it jumps out after each map click.Cancel the functionality after a single click...so no longer call the FunctionAND OR cancel the Function call if another button is pressed...Say I have 2 buttons...Click one and it allows me to select and do what my code is doing below....UNTIL I click the other button
<input type="button" id="button" value="Identify" />
on(dom.byId("button"), "click", function () {
featureLayer.setInfoTemplate(template);
initializeSidebar(app.map);
on(app.map.infoWindow, "show", function () {
featureLayer.setInfoTemplate(null);
})
})
function initializeSidebar(map){
var popup = map.infoWindow;
//when the selection changes update the side panel to display the popup info for the
//currently selected feature.
connect.connect(popup, "onSelectionChange", function(){
displayPopupContent(popup.getSelectedFeature());
});
//when the selection is cleared remove the popup content from the side panel.
connect.connect(popup, "onClearFeatures", function(){
//dom.byId replaces dojo.byId
dom.byId("featureCount").innerHTML = "Click to select feature(s)";
//registry.byId replaces dijit.byId
registry.byId("leftPane").set("content", "");
domUtils.hide(dom.byId("pager"));
});
//When features are associated with the map's info window update the sidebar with the new content.
connect.connect(popup, "onSetFeatures", function(){
displayPopupContent(popup.getSelectedFeature());
dom.byId("featureCount").innerHTML = popup.features.length + " feature(s) selected";
//enable navigation if more than one feature is selected
popup.features.length > 1 ? domUtils.show(dom.byId("pager")) : domUtils.hide(dom.byId("pager"));
});
}
function displayPopupContent(feature){
if(feature){
var content = feature.getContent();
registry.byId("leftPane").set("content", content);
}
}