Search code examples
javascriptgoogle-mapsgoogle-maps-api-2

error: "this.jc is not a function" (main.js line 853)


My map is acting strangely. The table that lists data about each marker does not highlight correctly, and the tablabels variable is giving some strange results. Some of my markers are gone and firebug is giving me an error that says "this.jc is not a function" and refers me to main.js line 853. This error really snuck up on me and I'm not even sure where to begin troubleshooting it. Any ideas? Has anyone seen anything like this?

Okay, after a suggestion to check events, I checked the myclick() function:

function myclick(i) {
      GEvent.trigger(gmarkers[i], "click");
    }

firebug says that "a" is undefined in main.js line 140 in regards to this function

Here's additional code, it might help

    //Highlights rows of all nested wells with same id as marker if it is a well marker
  GEvent.addListener(marker, "click", function() {
      marker.openInfoWindowHtml(html);

    //only highlight table for wells
    //markers with id = 2 are static wells, otherwise
    //we skip table highlighting
    if(marker.id==2)
    {
        var Table = document.getElementById("myTable3");
        var rows = Table.getElementsByTagName("tr");
        var f;
        for(f=0;f<rows.length;f++)
        {
            if(rows[f].id==marker.name)
                rows[f].className="selected";
            else
                rows[f].className="unselected"
        }
    }

    });

  //add marker, icon, and popup to global arrays
  gmarkers.push(marker);
  gmarkers[i] = marker;
  htmls[i] = popup_html;
  icons[i] = icon;
  /*Add data to each sidebar depending on id: 0=stream flow station, 1=rain gage, 2=well */
  if(id==0)
  {
      side_bar_html[0] += '<tr><td><a href="javascript:myclick(' + i + ')"  onmouseover="gmarkers['+i+'].blink(true,250)" onmouseout="gmarkers['+i+'].blink(false,0)">' + name + '</a><br></td>';
      side_bar_html[0] += '<td class="col1" align="center">' + number + '</td>' ;
      side_bar_html[0] += '<td class="col1" align="center">' + data2 + " " + ft +'</td>' ;
      side_bar_html[0] += '<td class="col1" align="center">' + update + '</td>';
      side_bar_html[0] += '<td class="col1" align="center"><a href=' + link + '>NWIS link</td></tr>' ;



  }
  if(id==2)
  {

     side_bar_html[2] += '<tr id=' + z + '><td><a href="javascript:myclick(' + i + ')"  onmouseover="gmarkers['+i+'].blink(true,250)" onmouseout="gmarkers['+i+'].blink(false,0)">' + number + '</a><br></td>'; 
     side_bar_html[2] += '<td class="col1" align="right">' + name + '</td>';
     side_bar_html[2] += '<td class="col1" align="right">' + data2 + '</td>';
     side_bar_html[2] += '<td class="col1" align="center">' + update + '</td>';
     side_bar_html[2] += '<td class="col1" align="center"><a href=' + link + '>NWIS Link</td></tr>' ;

     z++;
  }

  map.addOverlay(marker);
  ++i;

}

i just checked aspects of my marker variables. It appears that the ones that have gone missing are also duplicating certain content. Could this have something to do with the DupFlag variable?


Solution

  • I can't believe how simple this was to fix. I had accidentally deleted a line of code:

    map.addOverlay(marker);
    

    It was supposed to be after the loop that added data to the sidebar