3

I'm trying to add search bar in sharepoint map using esri leaflet.

It works well in IE, and google chrome...

Now If i use the same script in sharepoint.. I have this error: “Uncaught TypeError: Cannot read propenter code hereerty 'Controls' of undefined”

  • the first script is that i use for showing map
  • the second script is main file whish i use for import the js files

//Bare de recherche 
var results = new L.LayerGroup().addTo(oMap);
var searchControl = new L.esri.Controls.Geosearch().addTo(oMap);
//var searchControl = new L.esri.Geocoding.geosearch().addTo(oMap);

searchControl.on('results', function(data){
  results.clearLayers();
  for (var i = data.results.length - 1; i >= 0; i--) {
    results.addLayer(L.marker(data.results[i].latlng));
  }
});
setTimeout(function(){$('.pointer').fadeOut('slow');},3400);

<script type="text/javascript">

document.writeln("<script src='https://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.5/esri-leaflet.js'><" + "/script>");
  
document.writeln("<script src='https://cdn-geoweb.s3.amazonaws.com/esri-leaflet-geocoder/0.0.1-beta.5/esri-leaflet-geocoder.js'><" + "/script>");

 document.writeln("<link rel='stylesheet' href='https://cdn-geoweb.s3.amazonaws.com/esri-leaflet-geocoder/0.0.1-beta.5/esri-leaflet-geocoder.css'><" + "/link>");
//Fin de bar de recherche
</script>
alhusher
  • 31
  • 5
  • any reason why you can't use Leaflet 1.x and the latest releases of esri-leaflet and esri-leaflet-geocoder? if you must use leaflet 0.7.x, you should still upgrade to the most recent compatible versions (esri-leaflet 1.0.5 and esri-leaflet-geocoder 1.0.2). https://github.com/Esri/esri-leaflet/wiki/FAQ#can-i-use-esri-leaflet-with-leaflet-version-1x – john gravois May 01 '19 at 01:56
  • Thank you for the answer, I think it's sharepoint the problem, I tried version 1.4.0 of leaflet, esri-leaflet 2.2.4 and esri-leaflet-geocoder 2.2.14 but sharepoint which does not recognize "Geocoding" – alhusher May 02 '19 at 14:09

0 Answers0