Hi:
I would like to know if I can pass the Radzen Google Map reference into a javascript function in order to call the Google Api map methods inside the javascript directly.
Thanks
enchev
February 1, 2021, 8:02am
2
Hey @Portal_Traker ,
You can check the code for reference:
{
await MarkerClick.InvokeAsync(marker);
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
var data = Data != null ? Data : markers;
if (firstRender)
{
await JSRuntime.InvokeVoidAsync("Radzen.createMap", Element, DotNetObjectReference.Create(this), UniqueID, ApiKey, Zoom, Center,
data.Select(m => new { Title = m.Title, Label = m.Label, Position = m.Position }));
}
else
{
await JSRuntime.InvokeVoidAsync("Radzen.updateMap", UniqueID, Zoom, Center,
data.Select(m => new { Title = m.Title, Label = m.Label, Position = m.Position }));
}
}
public override void Dispose()
}
Radzen.loadGoogleMaps(defaultView, apiKey, resolve, reject);
});
};
api().then(function (google) {
Radzen[id] = ref;
Radzen[id].google = google;
Radzen[id].instance = new google.maps.Map(wrapper, {
center: center,
zoom: zoom
});
Radzen[id].instance.addListener('click', function (e) {
Radzen[id].invokeMethodAsync('RadzenGoogleMap.OnMapClick', {
Position: {Lat: e.latLng.lat(), Lng: e.latLng.lng()}
});
});