Add showInfowindow method to Markers #306

excid3 opened this Issue Dec 27, 2012 · 3 comments


None yet

2 participants

excid3 commented Dec 27, 2012

I wanted to propose adding a method like this to the Marker classes:

  showInfowindow : () ->
    @controller._closeVisibleInfoWindow(), @serviceObject)
    @controller._setVisibleInfoWindow @infowindow

We've got this method:

  _openInfowindow : () ->
    that = @
    return ->
      # Close the latest selected marker before opening the current one.
      that.controller._closeVisibleInfoWindow(), that.serviceObject)
      that.controller._setVisibleInfoWindow that.infowindow

Which is very similar and wondered what your thoughts were on adding something like this. It makes it really easy for me to add a "View on Map" link that I can use a data attribute to quickly find the marker and show the infowindow like so:

  $('.marker-link').on 'click', ->
    id = $(this).data("marker-id")
    marker = $.grep, (e) -> is id

Figured this might be useful, but wanted to get some feedback before I submitted a pull request.


what about:

showInfowindow : () ->
excid3 commented Jan 1, 2013

Yes if that works! (I'm not great at javascript yet). Just mainly wanted a simpler way to find and show the infowindow from javascript.

excid3 commented Feb 1, 2013

I'm revisiting this pretty late, but I can confirm that your code does work for me. (and it's a lot simpler 😄)

I can submit a pull request for this on just Google Maps, but I'm not familiar with how to do this on OpenLayers or Bing maps since I've never used them. I imagine it'd be useful to have on each, so do you know which docs to point me to and I'll see about adding this for the other providers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment