I'm allowing users to reset/recenter the map. I posted about it here.
I added the code that should work to reload the markers based on which checkboxes they selected.
To give you an idea of what I'm talking about, here's a screen shot of how the site looks when it first displays:
If I select a different view from the dropdown list (any state, or USA 50+), I can then select a checkbox or checkboxes and it/they will work, but my code that should redraw the markers based on which checkboxes were already clicked does not.
Here is the code that recenters the map as an item is selected from the dropdown:
$('#stateSelector').on("change",function() {
var $this = $(this).val();
if ($this == "USA (48)")
{
LoadUSA48();
}
else if ($this == "USA (50+)")
{
LoadUSA50();
}
else if ($this == "Alabama")
{
LoadAlabama();
}
. . .
else if ($this == "Wyoming")
{
LoadWyoming();
}
});
Here is an example Load() method:
function LoadAlabama() {
$("#map").removeData();
$("#map").goMap({
latitude: 32.806673,
longitude: -86.791133,
zoom: 8
});
}
There is a ReloadMarkers() method that is called at the end of the select event:
function ReloadMarkers() {
if ($('#NFLCheckbox').is(':checked')) {
ShowNFLMarkers();
}
. . .
if ($('#AmMusiciansCheckbox').is(':checked')) {
ShowMusiciansMarkers();
}
}
The ShowX() methods contains all the appropriate of the following type of code:
$.goMap.createMarker({
address: 'Green Bay, Wisconsin',
title: 'Green Bay Packers',
group: 'NFLGroup',
icon: constants.nflIcon,
html: getPackers()
});
It's as if the checked state of the checkboxes is not being recognized...