Hi, I am trying to customize the Exp Building Map Widget with a on click event to highlight and select the features I click on at that spot for instance both the building and parcel at that point. The issue I am having is it will not highlight and I haven't been able to figure out why.
Here is my snippet of code in the widget.tsx file:
jmv.view.on("click", function(event) {
if(jmv) {
let myLayers: String = ""
if (identifyLayers.trim() == "") {
myLayers = bufferLayers;
} else {
myLayers = identifyLayers + "," + bufferLayers
}
const myClickableLayers = myLayers.split(',')
const mapLyrVws = jmv.jimuLayerViews
const dsObj = DataSourceManager.getInstance()
for (const key in mapLyrVws) {
const ds = mapLyrVws[key].id
const lyrVw = mapLyrVws[key]
if (myClickableLayers.includes(lyrVw.layer.title)) {
//if (lyrVw.layer.popupEnabled) {
let query = lyrVw.layer.createQuery();
query.geometry = jmv.view.toMap(event);
query.returnGeometry = true;
query.outFields = [ "*" ]
lyrVw.layer.queryFeatures(query).then(function(results) {
if (lyrVw.layer.title == "Buildings") { // || lyrVw.layer.title == "Parcel QL" || lyrVw.layer.title == "PARCEL No Buildings") {
alert(lyrVw.type)
alert(results.features[0].attributes.OBJECTID)
lyrVw.selectFeatureById(results.features[0].attributes.OBJECTID)
const myExtent = results.features[0].geometry.extent.expand(extent_level)
jmv.view.goTo(myExtent)
}
})
//}
}
}
}
});