Select to view content in your preferred language

Pop up specific window

3478
13
Jump to solution
05-08-2013 10:32 AM
RayJulich
Emerging Contributor
I created a map (http://wa.water.usgs.gov/projects/clovercreek/hydrographs.esri.htm), which has a drop down menu just above the map so a person can select a specific point on the map. I had created this map in Google Maps (http://wa.water.usgs.gov/projects/clovercreek/hydrographs.htm) and I got the drop down menu working like this:

As I looped through the text file added the points to the map, I added each point to an array:
var gmarkers = [];

gmarkers = marker;
i++;


The dropdown menu called a function that opened the specific popup window:
function reveal_site(i){
    GEvent.trigger(gmarkers, "click");
}


Is there a way to open the popup window for a specific site from a drop down menu in ESRI Javascript API?
0 Kudos
13 Replies
BrittneyGibbons
Occasional Contributor
How are you changing the symbology of the highlighted symbol on click? It should be possible to do something similar for the dropdown menu as well. Can you set the symbol of gmarker[index] to your highlight symbol in the function reveal site?
0 Kudos
RayJulich
Emerging Contributor
I don't do anything to explicitly change the symbology. I noticed that the point started to be highlighted once I upgraded by web page's code to use API 3.5. The point only seems to be highlighted when a user clicks on a point, but not when the user selects the point from the dropdown menu.
0 Kudos
RayJulich
Emerging Contributor
Something else I noticed this morning is that when I click on a point, an infoWindow opens (Image 1), and click the X to close the infoWindow (Image 2), if I then open an infoWindow from the dropdown  menu, the last point that I clicked on will be hightlighted (Image 3).

[ATTACH=CONFIG]26250[/ATTACH] [ATTACH=CONFIG]26251[/ATTACH] [ATTACH=CONFIG]26252[/ATTACH]
0 Kudos
aubinmaynard
Deactivated User
Could we see some additional code you used.  I"m trying to be able to click a row in a dynamically created table (i.e. from a query), and have it open the infowindow for that particular graphic.  I understand the concept behind map.infoWindow.show(point, point) but cannot figure out how to dump my geometry data into it from clicking the table.  Any additional hints would be great,

Thanks!

I did something similar for one of my maps with query results and clicking on a page element to show the infoWindow so my method might be similar to what you are looking for. Does the index of your graphic layer match the index of your drop down list? If it does, you should be able to use the index to tap into the geometry of the point to show your infoWindow.

The code would be something like this:

function reveal_site(i){
point = gmarkers.geometry;
point = esri.geometry.geographicToWebMercator(point);
map.infoWindow.setTitle(gmarkers.getTitle());
map.infoWindow.setContent(gmarkers.getContent());
map.infoWindow.show(point, point);
}

This is similar to what you have, but your code is triggered by a click event on the map while you want it to fire when something from the dropdown menu is selected. You should be able to call the function from the dropdown menu and use the index to decide which point to show the infoWindow for. Just be careful with your variable declarations- the gmarker variable may need to be global to work in this case. Also not sure how your graphics layer is set up exactly - I was using results from a query when I did this so the geometry of the points was returned. If I understand your file right, you may need to use the lat and long fields in place of the geometry.

If this seems like it might be promising, I can try to go into more detail. Good luck, hope this is helpful!
0 Kudos