Quick reply, thanks!

On May 24, 9:41 am, "[email protected]" <[email protected]>
wrote:
> On May 24, 8:13 am, Joe Gawron <[email protected]> wrote:
>
>
>
> > Hi, all
>
> > Please consider the following code snips as returning my desired
> > infoWindow 'Click' event behavior:
> > ...
> >      var markerWindowContent = customAction(row) ;
> >      google.maps.event.addListener(featureMarker, 'click',
> > function(event) {
> >         // first close any currently open infoWindow
> >         if (!isEmpty(layerWindow.getContent())) {
> >                 layerWindow.close();
> >         }
> >     layerWindow.setContent(markerWindowContent);
> >     layerWindow.setPosition(coordinate) ;
> > //  test for streetView
> >     if (!campusViewFlag) {
> >                 layerWindow.open(map);
> >     } else {
> >         layerWindow.open(campusView);
> >     }
> >        // And add a listener to ensure the map is centered on the
> > feature coordinate when closing the infoWindow
> >        //   ** note this is inside the click listener, otherwise the
> > markerWindow is undefined so this listener barfs.
> >         google.maps.event.addListener(layerWindow,'closeclick',
> > function() {
> >                 current_loc = coordinate ;
> >                         clickFlag = true ;
> >                 resetZoomAndCenter();
> >                 clickFlag = false ;
> >                 });
> >      });
>
> > function customAction(dataRow) {
> > var builtInfoWindow ;
> > switch (dataRow[13]) {
> > case "clickthrough":
> >         var open_link = window.open('','_top');
> >         open_link.location=dataRow[11];
> >         builtInfoWindow = dataRow[0] ;
> > break ;
> > default:
> >         builtInfoWindow = "<div id='smallpopup' class='smallpopup'><div
> > id='smallpopup_title' class='smallpopup_title'>" ;
> >         builtInfoWindow = builtInfoWindow + dataRow[0] + "</div>";
> >         builtInfoWindow = builtInfoWindow + "<div 
> > id='smallpopup_description'
> > class='smallpopup_description'>" + dataRow[1] ;
> >         builtInfoWindow = builtInfoWindow + "<br /><a href='" + dataRow[11] 
> > +
> > "'>" + dataRow[12] + "</a>";
> >         builtInfoWindow = builtInfoWindow + "<div></div>" ;
> >         }
> > return builtInfoWindow ;
>
> > }
>
> > The first is the usual event handler.  The second determines what the
> > viewer will see.  The intent is if dataRow[13], where dataRow is a row
> > of data from a Fusion Table extract, contains something, the click
> > behavior will be something other than the standard infoWindow.  In
> > this case, 'clickthrough' should send the viewer directly to a link
> > stored in dataRow[11].
>
> > Further, I call the customAction function from two places; a set of
> > data directly from FusionTables, and a set of data from GViz to allow
> > me custom markers.  Either way, the same code gets called for creating
> > the click handler action.
>
> > When I create the handler for a data row from Fusion Tables, it works
> > as expected, and transfers windows when clicked.  But, when I create
> > the handlers for the GViz markers, it executes the window transfer on
> > the handler creation.  Same code, same passed data structure, I think,
> > but different results.
>
> > Anybody have an idea why?
>
> The set of open_link.location happens when you execute
> customAction(row), not when the click listener runs. My guess is you
> want that call inside the click listener.
>
>   -- Larry
>
>
 Ah, you're right; when I call this for the polys, it's inside the
handler, but outside (by one line, oops) for the markers..  Nice
catch.   BOYC to you!

thanks!
Joe

>
> > and if you need the map page, it's
>
> https://aledev.boisestate.edu/joegawron/campusmap/TestMap.html
>
> > Be warned the code sucks to read.
>
> > thanks,
> > Joe

-- 
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.

Reply via email to