Select to view content in your preferred language

Formatting InfoWindow from Select with Feature Layer sample

855
1
10-16-2013 01:02 PM
JessicaKnight1
Occasional Contributor
I am using this as a guide: https://developers.arcgis.com/en/javascript/jssamples/query_buffer.html

I have put it into my code to use with my own data. The biggest problem I am having with it is that the info window seems to be hard to configure based on that sample code. I want to format it like the Identify task I have set up, where I can change the field name title, etc. And I don't want to have the FID show up (in this sample the ObjectID shows up and isn't requested, in mine its the FID). I can configure the field name titles but I can't get the values associated with them.

Hopefully I've explained this well.

This is what the info window looks like for the selection:
[ATTACH=CONFIG]28382[/ATTACH]

Info window for the identify task (which I want the selection result to look like):
[ATTACH=CONFIG]28383[/ATTACH]

Thanks.
0 Kudos
1 Reply
by Anonymous User
Not applicable
Original User: evtguy

In the sample you refer to, this portion of the code:
infoTemplate: new InfoTemplate("Block: ${BLOCK}", "${*}"),

is what populates the infoWindow and the "${*}" specifies that the infoWindow will show all fields specified in the outFields list. What you need to do is tweak this to just list the fields you want. Something like this:
infoTemplate: new InfoTemplate("Block: ${BLOCK}", "Facility: ${FACILITY}<br>Products: ${PRODUCTS}<br>Status: ${STATUS}"),
outFields: ["BLOCK","FACILITY","PRODUCTS"]


Don't forget to specify the field name that's used in the title of the infoWindow (I couldn't figure it out from what you posted). I think this will get you what you want.

Steve
0 Kudos