For this line: markerNodes = markerNodes.sort(fSortOnState); I keep getting: fSortOnState is not defined
Is there a reason for this? -Mike On Mar 31, 5:34 pm, usgolfers <[email protected]> wrote: > Mike, > > I assume you are getting an array of Marker nodes as is done in the code. > If so you could split the create operations and do an array sort prior to > option creation > > for (var i = 0; i < markerNodes.length; i++) { > var name = markerNodes[i].getAttribute("name"); > var address = markerNodes[i].getAttribute("address"); > var distance = parseFloat(markerNodes[i].getAttribute("distance")); > var latlng = new google.maps.LatLng( > parseFloat(markerNodes[i].getAttribute("lat")), > parseFloat(markerNodes[i].getAttribute("lng"))); > > createMarker(latlng, name, address); > bounds.extend(latlng); > } > > markerNodes = markerNodes.sort(fSortOnState); > > for (var i = 0; i < markerNodes.length; i++) { > var name = markerNodes[i].getAttribute("name"); > var address = markerNodes[i].getAttribute("address"); > var distance = parseFloat(markerNodes[i].getAttribute("distance")); > var latlng = new google.maps.LatLng( > parseFloat(markerNodes[i].getAttribute("lat")), > parseFloat(markerNodes[i].getAttribute("lng"))); > > createOption(name, distance, i); > } > > function fSortonState(a,b) > { > if(parseFloat(a.getAttribute("distance")) > > parseFloat(b.getAttribute("distance"))) > return 1; > > if(parseFloat(a.getAttribute("distance")) < > parseFloat(b.getAttribute("distance"))) > return -1; > > if(parseFloat(a.getAttribute("state")) > parseFloat(b.getAttribute("state"))) > return 1; > > if(parseFloat(a.getAttribute("state")) < parseFloat(b.getAttribute("state"))) > return -1; > return 0; > > > > > > > > } -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
