Google Map Sidebar

baderajhar

New Member
I'm trying to have an interactive sidebar for my GoogleMap visualization; this sidebar should include a list of filtered markers and when I click on any link it triggers the infowindow inside the map, just like this (http://jsfiddle.net/doktormolle/HNd6H/).
I went through two threads (https://goo.gl/hDQevS) and (https://goo.gl/xVm4sB) and I didn't find an answer to two questions:
  1. How to get the list of filtered markers in order to create HTML links?
  2. How to trigger infowindow from external HTML link? I tried the below JS code and it returned "Uncaught TypeError: Cannot read property '0' of undefined at HTMLAnchorElement.<anonymous>"
JavaScript:
requirejs(['fab/fabrik'], function () {
var h = document.getElementById("link");
h.addEventListener("click", function (viz) {
  google.maps.event.trigger(viz.markers[0], 'click');
  });
});
 
The markers are ...

Code:
var viz = Fabrik.getBlock('viz_123');
// markers are now in viz.markers
viz.markers.each(function(marker) {
   // insert marker.title into your sidebar DOM element
}
 
Thanks, it worked, but I used this
var viz = Fabrik.getBlock('visualization_123');
instead of this
var viz = Fabrik.getBlock('viz_123');

JavaScript:
requirejs(['fab/fabrik'], function () {
var h = document.getElementById("link");
var viz = Fabrik.getBlock('visualization_123');
h.addEventListener("click", function (viz) {
  google.maps.event.trigger(viz.markers[0], 'click');
  });
});
 
It didn't work perfectly, sometimes it works and most of the time it's giving "Uncaught TypeError: Cannot read property '0' of undefined"
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top