logo
down
shadow

Google map info window left arrow,right arrow passing TypeError: Cannot read property '__e3_' of undefined?


Google map info window left arrow,right arrow passing TypeError: Cannot read property '__e3_' of undefined?

By : a4ron
Date : November 22 2020, 09:00 AM
this will help The error Cannot read property '__e3_' of undefined usually occurs when object for google.maps.event.trigger function could not be found or invalid. In your case the specified error occurs in two cases:
1) markerClick event is triggered,at some point you are getting marker out of bounds array.
code :
$scope.markerClick=function(i){
    if (i<0) i=$scope.markers.length-1;
    if (i >= $scope.markers.length) i=0;         
    google.maps.event.trigger( $scope.markers[i], 'click' );
};
createMarker(filteredCities[i]);
createMarker(filteredCities[i],i);


Share : facebook icon twitter icon
Google Maps API: Uncaught TypeError: Cannot read property '__e3_' of undefined

Google Maps API: Uncaught TypeError: Cannot read property '__e3_' of undefined


By : Tryhelp
Date : March 29 2020, 07:55 AM
may help you . When I moved the map definition to a point before the marked buggy code, it worked. I added the var map = new google.map.Map to right after the map options.
code :
  var myOptions = {
     streetViewControl: false,
     overviewMapControl: true,
    zoom: 14,
    mapTypeId: google.maps.MapTypeId.ROADMAP
};

var map = new google.maps.Map(document.getElementById('weather-map'), myOptions);

// MOLNAKTIVITET
var cloudLayer = new google.maps.weather.CloudLayer();
cloudLayer.setMap(map);



/**********************************************
**    THE CODE BELOW IS CAUSING THE ERROR    **
**********************************************/

// HÖJD ÖVER / UNDER HAVSYTAN
elevator = new google.maps.ElevationService();
google.maps.event.addListener(map, 'click', getElevation);
Uncaught TypeError: Cannot read property '__e3_' of undefined

Uncaught TypeError: Cannot read property '__e3_' of undefined


By : kaiming zhou
Date : March 29 2020, 07:55 AM
will be helpful for those in need Move the creation of map to the top of the function.
Currently you use map as map-option for markers, where it's expected to be a google.maps.Map-instance(but it's undefined, because the map isn't created yet)
JavaScript & Google Maps - Uncaught TypeError: Cannot read property '__e3_' of undefined

JavaScript & Google Maps - Uncaught TypeError: Cannot read property '__e3_' of undefined


By : Abhi Syaqif
Date : March 29 2020, 07:55 AM
seems to work fine The map is NOT created by echoing $map['js'], it's created by calling $this->googlemaps->create_map() in the controller, storing the results, passing them to the view and echoing them. You might want to take a look at the example:
http://biostall.com/demos/google-maps-v3-api-codeigniter-library/
Triggering infoWindow click - Uncaught TypeError: Cannot read property '__e3_' of undefined

Triggering infoWindow click - Uncaught TypeError: Cannot read property '__e3_' of undefined


By : user3820
Date : March 29 2020, 07:55 AM
it helps some times This is a common problem defining references to markers in loops. One way to solve it is with function closure (a function that keeps closure on its arguments):
code :
function buildListView() {
    controlList.innerHTML = '';
    for (var i = 0; i < gyms.length; i++) {
        if (gyms[i]) {
            clickableLink(i);
        }
    }
}

function clickableLink(i) {
    var li = document.createElement('li');
    li.onclick = function () {
        google.maps.event.trigger(markers[i], 'click'); //<<--This line!
    };
    li.innerHTML = gyms[i].name;
    li.style.padding = '15px';
    li.style.cursor = 'pointer';
    li.setAttribute("id", gyms[i].name);
    controlList.appendChild(li);

}
var madison,
  map,
  infoWindow,
  autocomplete,
  service,
  controlList,
  messageDiv;

var anyInfoWindowSeenAlready = false;

var markers = [],
  gyms = [];

var hostnameRegexp = new RegExp('^https?://.+?/');

function initialize() {
  madison = new google.maps.LatLng(43.0667, -89.4000),
    mapOptions = {
      center: madison,
      zoom: 12,
      streetViewControl: false,
      mapTypeControl: false
    },
    autocompleteOptions = {
      types: ['(cities)']
    };

  map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

  infoWindow = new google.maps.InfoWindow({
    content: document.getElementById('info-content')
  });

  document.getElementById('info-content').style.display = 'none';

  var input = document.getElementById('pac-input');
  map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);

  // Create the DIV to hold the control and call the 
  // ListControl() constructor passing in this DIV.
  var listControlDiv = document.createElement('div');
  var listControl = new ListControl(listControlDiv, map);
  map.controls[google.maps.ControlPosition.LEFT_TOP].push(listControlDiv);

  // Create the 'Find a gym near you!' message div and 
  // push it onto the map canvas as a map control
  messageDiv = document.createElement('div');
  messageDiv = buildMessageDiv(messageDiv);
  map.controls[google.maps.ControlPosition.TOP_CENTER].push(messageDiv);

  autocomplete = new google.maps.places.Autocomplete(input, autocompleteOptions);
  service = new google.maps.places.PlacesService(map);

  var request = {
    location: madison,
    radius: 25000,
    types: ['gym']
  };
  service.nearbySearch(request, callback);
  google.maps.event.addListener(autocomplete, 'place_changed', onPlaceChanged);
}

/**
 * The ListControl adds a control to the map that
 * displays the search results in a list view. This
 * constructor takes the control DIV as an argument.
 */
function ListControl(controlDiv, map) {

  var madison = new google.maps.LatLng(43.0667, -89.4000);

  // Set CSS styles for the DIV containing the control
  // Setting padding to 5 px will offset the control
  // from the edge of the map.
  controlDiv.style.padding = '10px';
  controlDiv.style.opacity = '0.6';

  // Set CSS for the control border.
  var controlUI = document.createElement('div');
  controlUI.style.backgroundColor = 'white';
  controlUI.style.borderStyle = 'solid';
  controlUI.style.borderWidth = '1px';
  controlUI.style.textAlign = 'center';
  controlUI.title = 'List of gyms returned by search';
  controlDiv.appendChild(controlUI);

  // Set CSS for the control interior.
  controlList = document.createElement('ul');
  controlList.style.listStyleType = 'none';
  controlList.style.maxHeight = '500px';
  controlList.style.maxWidth = '300px';
  controlList.style.overflowY = 'auto';
  controlList.style.overflowX = 'hidden';
  controlList.style.fontFamily = 'Arial,sans-serif';
  controlList.style.fontSize = '16px';
  controlList.style.padding = '0px';
  controlList.style.margin = '0px';
  controlUI.appendChild(controlList);

  // Setup the click event listeners
  // google.maps.event.addDomListener(controlUI, 'click', function() {
  //   map.setCenter(madison)
  // });
}

// When the user selects a city, perform a nearbySearch() 
// for gyms in that city
function onPlaceChanged() {
  var place = autocomplete.getPlace();
  if (place.geometry) {
    clearMarkers();
    map.panTo(place.geometry.location);
    map.setZoom(12);
    var request = {
      location: place.geometry.location,
      radius: 25000,
      types: ['gym']
    };
    service.nearbySearch(request, callback);
    messageDiv.style.fontSize = '14px';
    messageDiv.innerHTML = '<h1>Here are the top 20 gyms in your city. Click to see details.</h1>';
  } else {
    document.getElementById('pac-input').placeholder = 'Start typing city name, then select a city from list';
  }
}

function buildMessageDiv(messageDiv) {
  messageDiv.innerHTML = '<h1>Find a gym near you!</h1>';
  messageDiv.style.textAlign = 'center';
  messageDiv.style.fontSize = '20px';
  messageDiv.style.visibility = 'visible';
  return messageDiv;

}


function callback(results, status) {
  if (status == google.maps.places.PlacesServiceStatus.OK) {
    gyms = results;
    for (var i = 0; i < gyms.length; i++) {
      markers[i] = createMarker(gyms[i]);
      markers[i].placeResult = gyms[i];
    }
  }
  buildListView();
}

function createMarker(place) {
  var placeLoc = place.geometry.location;
  var marker = new google.maps.Marker({
    map: map,
    position: placeLoc
  });

  google.maps.event.addListener(marker, 'click', showInfoWindow);

  return marker;
}

function clearMarkers() {
  for (var i = 0; i < markers.length; i++) {
    if (markers[i]) {
      markers[i].setMap(null);
    }
  }
  markers = [];
}

function buildListView() {
  controlList.innerHTML = '';
  for (var i = 0; i < gyms.length; i++) {
    if (gyms[i]) {
      clickableLink(i);
    }
  }
}

function clickableLink(i) {
  var li = document.createElement('li');
  li.onclick = function() {
    google.maps.event.trigger(markers[i], 'click'); //<<--This line!
  };
  li.innerHTML = gyms[i].name;
  li.style.padding = '15px';
  li.style.cursor = 'pointer';
  li.setAttribute("id", gyms[i].name);
  controlList.appendChild(li);

}

// Get the place details for a hotel. Show the information in an info window,
// anchored on the marker for the hotel that the user selected.
function showInfoWindow() {
  var marker = this;
  service.getDetails({
      placeId: marker.placeResult.place_id
    },

    function(place, status) {
      if (status != google.maps.places.PlacesServiceStatus.OK) {
        return;
      }
      if (anyInfoWindowSeenAlready === false) {
        document.getElementById('info-content').style.display = 'initial';
      }
      infoWindow.open(map, marker);
      buildIWContent(place);
      anyInfoWindowSeenAlready = true;
    });
}

// Load the place information into the HTML elements used by the info window.
function buildIWContent(place) {
  document.getElementById('iw-icon').innerHTML = '<img class="hotelIcon" ' +
    'src="' + place.icon + '"/>';
  document.getElementById('iw-url').innerHTML = '<b><a href="' + place.url +
    '">' + place.name + '</a></b>';
  document.getElementById('iw-address').textContent = place.vicinity;

  if (place.formatted_phone_number) {
    document.getElementById('iw-phone-row').style.display = '';
    document.getElementById('iw-phone').textContent = place.formatted_phone_number;
  } else {
    document.getElementById('iw-phone-row').style.display = 'none';
  }

  // Assign a five-star rating to the hotel, using a black star ('&#10029;')
  // to indicate the rating the hotel has earned, and a white star ('&#10025;')
  // for the rating points not achieved.
  if (place.rating) {
    var ratingHtml = '';
    for (var i = 0; i < 5; i++) {
      if (place.rating < (i + 0.5)) {
        ratingHtml += '&#10025;';
      } else {
        ratingHtml += '&#10029;';
      }
      document.getElementById('iw-rating-row').style.display = '';
      document.getElementById('iw-rating').innerHTML = ratingHtml;
    }
  } else {
    document.getElementById('iw-rating-row').style.display = 'none';
  }

  // The regexp isolates the first part of the URL (domain plus subdomain)
  // to give a short URL for displaying in the info window.
  if (place.website) {
    var fullUrl = place.website;
    var website = hostnameRegexp.exec(place.website);
    if (website == null) {
      website = 'http://' + place.website + '/';
      fullUrl = website;
    }
    document.getElementById('iw-website-row').style.display = '';
    document.getElementById('iw-website').textContent = website;
  } else {
    document.getElementById('iw-website-row').style.display = 'none';
  }
}

google.maps.event.addDomListener(window, 'load', initialize);
html,
body,
#map-canvas {
  height: 100%;
  margin: 0px;
  padding: 0px
}
#pac-input {
  width: 350px;
  height: 25px;
  font-size: 16px;
  margin: 10px;
  padding: 5px
}
ul {
  z-index: 2;
  /* Fixes infoWindow and list view overlap issue */
}
li:hover {
  background: gray;
  color: white;
}
table {
  font-size: 12px;
}
.placeIcon {
  width: 20px;
  height: 34px;
  margin: 4px;
}
.hotelIcon {
  width: 24px;
  height: 24px;
}
#rating {
  font-size: 13px;
  font-family: Arial Unicode MS;
}
.iw_table_row {
  height: 18px;
}
.iw_attribute_name {
  font-weight: bold;
  text-align: right;
}
.iw_table_icon {
  text-align: right;
}
<script src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>

<input id="pac-input" class="controls" type="text" placeholder="Start typing city name, then select a city from list">
<div id="map-canvas"></div>
<div id="info-content">
  <table>
    <tr id="iw-url-row" class="iw_table_row">
      <td id="iw-icon" class="iw_table_icon"></td>
      <td id="iw-url"></td>
    </tr>
    <tr id="iw-address-row" class="iw_table_row">
      <td class="iw_attribute_name">Address:</td>
      <td id="iw-address"></td>
    </tr>
    <tr id="iw-phone-row" class="iw_table_row">
      <td class="iw_attribute_name">Telephone:</td>
      <td id="iw-phone"></td>
    </tr>
    <tr id="iw-rating-row" class="iw_table_row">
      <td class="iw_attribute_name">Rating:</td>
      <td id="iw-rating"></td>
    </tr>
    <tr id="iw-website-row" class="iw_table_row">
      <td class="iw_attribute_name">Website:</td>
      <td id="iw-website"></td>
    </tr>
  </table>
</div>
React passing arrow function as props to component. Cannot read property 'purchaseAd' of undefined

React passing arrow function as props to component. Cannot read property 'purchaseAd' of undefined


By : Matthew Agostino
Date : March 29 2020, 07:55 AM
Does that help This line: this.state.sellerData.map(function(advertiser)
When you use a non arrow function here, the value of this changes when that function is invoked. Convert that to an arrow function like this: this.state.sellerData.map((advertiser) => and you should be all set
Related Posts Related Posts :
  • How to hide a div from angular controller
  • Can Promise load multi urls in order?
  • How enable Hover event for bootstrap menus?
  • D3 scale.invert() isn't returning date for x
  • Parsing object to array using underscore js or lodash
  • ES6 with React and Browserify
  • AngularJS Factory return type undefined
  • javascript follow html input fields
  • how to declare a double array in javascript for this particular UI
  • Jquery : find length of mixed list
  • Returning the array before the function is complete & Angular JS
  • Javascript set value of class & hidden input in nested divs
  • Register custom filters with vue.js
  • Add class to input parent
  • Angular controller not talking to view
  • Trouble creating "if then" Javascript statement to change background color of page
  • Socket.IO - Middleware and scoping: how should I access global IO object from external middleware?
  • add class when input is valid in angularjs
  • Positioning multiple div elements
  • Checkbox clicking works, deselecting checkbox not working Javascript
  • Adding ajax jQuery File upload
  • Creating a dynamic array within a dynamic array in JQuery
  • Multiple File Upload actions for a single File Input PHP/JS
  • Want to move an added element to a different part of the DOM
  • Why can't I get Angularjs to work?
  • Minimizing browser window in Firefox & Chrome adds white space to right of page
  • I need to insert the date and time of employee stamp in and out into mysql database
  • Making css auto slider
  • why can't I defne the function first?
  • Pagination with MongoDB in Node.js (With Sorting)
  • How to repeat each() without page refresh
  • Position div at position of another div
  • Click handler is called multiple times in jQuery animate
  • How to multiply each element in an array with a different number (javascript)
  • Constructing a query string for JQuery getJSON for a public API GET request
  • Server side error generating RSS - what to return back to user/RSS reader?
  • ES6 code on Nodejs 4.x : Is V8 4.5 a native JS engine that runs ES6 directly?
  • How to only get new data without existing data from a Firebase?
  • How to set default option d3.js
  • using enum in Javascript for month number against name
  • React component only changes state on second onClick event
  • JavaScript text area: add line break
  • Unobtrusive jQuery unobtrusive validation not showing error spans
  • get the location for objects in a firebase array?
  • Multiple addEventListener not storing unique callbacks
  • JQuery, variable inside function not recognized by action
  • User input in Javascript
  • JavaScript Regex Remove Content from String
  • Is there a way to apply a mask on keydown? (JQuery)
  • Redirect A Live Website Visitor Without Them Refreshing or Clicking anything?
  • Exclude HTML tags when translating with Google Translate API
  • Posting to a ColdFusion function from angularJS
  • How to nullify the fadeout?
  • JS not updating on enquire.js breakpoints
  • AngularFire Check if item of same title exists
  • add names to objects based on object value
  • When do you use "class" versus "id"?
  • Get content of loaded SVG file
  • How to find size of an image file from canvas?
  • ui-sref="articles.view({articleId: article._id})" meaning?
  • shadow
    Privacy Policy - Terms - Contact Us © animezone.co