I have been working with this sample (Call function from Popup window ) and I can't get it to work. I am working with a dojo widget for CMV. I have an infowindow that scrolls through a set of returns and it is working fine. I am trying to set up a link to a function that will highlight each feature shown in the infowindow when the user clicks (i.e. a link to a function that would be an href from the html -- this example Multiple Query Results | ArcGIS API for JavaScript 3.30 would do what I want, but I can't call the function from within the html.)
So now I'm just trying to add the link to the actionpane of the infowindow and it is not showing up. I haven't even gotten to testing the function as I can't even get the visual link to show up. I can't see what is different from the example I refer to in the first sentence above. The only change I made was changing the reference to "window.map.infoWindow.domNode)[0])" to "this.map.infoWindow.domNode)[0])":
var link = domConstruct.create("a", {
"class": "action mylink",
"id": "statsLink",
"innerHTML": "Action Link Test", //text that appears in the popup for the link
"href": "javascript: void(0);"
}, query(".actionList", this.map.infoWindow.domNode)[0]);
on(link, "click", this.myfunction());
I can get the link to show up if I use this sample from the Popup Documentation, but this format won't allow me to call my function.
var customActions;
map.infoWindow.on("selection-change", function() {
var selectedFeature = map.infoWindow.getSelectedFeature();
if (selectedFeature && selectedFeature.attributes.TYPE === "crime") {
var crimeAction = {
title: "Crime Report",
className: "crime-report-action",
callback: function() {
console.log("Get Full Crime Report");
}
};
customActions = map.infoWindow.addActions([ crimeAction ]);
}
else {
map.infoWindow.removeActions(customActions);
}
});
Any help would be greatly appreciated! Thanks!