I meet a problem when trying to add button on popupTemplate in ARCGIS JavaScript;My environment is node.js, and the version of ARCGIS JavaScript is 4.28.
The code snippet is as following:
const popupTemplate = {
title: "{Name}",
content: "{Description}"
}
var graphicID = "testing_1";
const buttonHTML = `<button class="btn btn-danger" onclick="DeleteSelectedDiagram('${graphicID}')">Delete the Diagram</button>`;
graphic = new Graphic({
geometry: new geometry.Polygon({
rings: coordinates,
spatialReference: {
wkid: 3826
},
id:"testing_1"
}),
symbol: {
type: "simple-fill",
color: [255, 0, 0, 0.3], // Red color with 0.3 opacity
outline: {
color: [255, 0, 0], // Red color
width: 1
}
},
attributes: {
Name: "Diagram Infos",
Description: buttonHTML
},
popupTemplate: popupTemplate
});
However, it is not working,the css style of button is disappear and popupTemplate only show the words "Delete the Diagram".
Is there any method to add button with click event to popupTemplate? any instruction is highly appreciated, thanks a lot.