InfoWindow Help

130
3
Jump to solution
02-21-2019 10:14 AM
KevinHanley2
New Contributor II

A few general questions about InfoWindow, if you'll indulge me.

Right now I have an infoTemplate set with one of my ArcGISDynamicServiceLayers. It works as it should. When I click on a parcel on the map, it pops up the InfoWindow with the information as set in the InfoTemplate.

infoTemplate = new InfoTemplate("${PIN_DSP}","<b>${OWNER_NAME}</b>");

var parcelsLayer = new ArcGISDynamicMapServiceLayer("http://172.27.8.54/okaloosagis/rest/services/PropertyApp/ParcelService/MapServer", {
"id": "Parcels",
"visible": true,
disableClientCaching: true,
useMapImage: true
});

parcelsLayer.setInfoTemplates({
14: {infoTemplate: infoTemplate}
})

Next I added the ability to use the Extent draw feature to select multiple parcels at once. I wanted to use the same InfoTemplate to display any number of parcels that I select, with the ability to click on Previous/Next Feature to move between them.

function showFeatureSet(fset,evt, infoTemplate) {
map.graphics.clear();
featureSet = fset;
var numFeatures = featureSet.features.length;
var features = fset.features

var content = "";
debugger;
for (var i=0; i<numFeatures; i++) {
var graphic = featureSet.features;
content = graphic.attributes.OWNER_NAME;

infoTemplate = new InfoTemplate("${PIN_DSP}","<b>${OWNER_NAME}</b>");

graphic.setInfoTemplate(infoTemplate);
graphic.symbol = fillSymbol;
map.graphics.add(graphic);
map.infoWindow.setContent(content);
}
map.infoWindow.show(evt.screenPoint);
}

I don't think this is the correct way to do it, for many reasons. One, I read that the InfoTemplate defaults to highlighting the parcel, as it does when I click on a single parcel. In this situation, I have to physically use a fillSymbol, which I didn't think I had to do.

Secondly, I can't figure out how to load the multiple parcels into the InfoWindow so that it prompts me with "Next Feature/Previous Feature" like I've seen it do if I click in the middle of two single parcels. In the code that I've tried, I can either get it to show multiple parcels in a single InfoWindow with all the data jumbled together, or it just shows the last parcel loaded from the group selected.

Lastly, how would you recommend I tell the InfoWindow where to load in a "select by extent" kind of situation? It doesn't seem to register evt.ScreenPoint, so it's just displaying it in the top left corner unless previously used, in which it just loads it wherever it was displayed previously.

I apologize if this is way too many questions at once, and I appreciate your time.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Kevin,

   To show a popup for multiple features and the those features layer has a popupTemplate or infoTemplate assigned you have to do this.

map.infoWindow.setFeatures(yourArrayofGraphicsFromTheQuery);‍‍
map.infoWindow.show(evt.screenPoint);

View solution in original post

3 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Kevin,

   To show a popup for multiple features and the those features layer has a popupTemplate or infoTemplate assigned you have to do this.

map.infoWindow.setFeatures(yourArrayofGraphicsFromTheQuery);‍‍
map.infoWindow.show(evt.screenPoint);
KevinHanley2
New Contributor II

That worked perfectly. Thank you! I was hung up on that for days.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.

0 Kudos