Wisej.GoogleMaps get when widget ready

Answered
0
0

Hi all,

i’m trying to draw some line on Google Maps when a window is loaded (without user interaction), but i’m getting “google is not define” from js. This not heppen after some second (widget loaded i assume).

I also tested with example offered here, but same problem (attached edit version).

I also read this post, but i’m unable to access to InitScript from Wisej.GoogleMaps to fire a “ready” widget event.

 

Any solutions?

Thanks.

 

Google API polyline

  • You must to post comments
Best Answer
0
0

Option 1:

Use the “initialized”event already fired by the extension. In your JavaScript.js add:

this.addListener("initialized", function (e) {
   this.fireWidgetEvent("initialized");
});

In MapPage.cs add:

this.googleMap1.WidgetEvent += GoogleMap1_WidgetEvent;

private void GoogleMap1_WidgetEvent(object sender, WidgetEventArgs e) {
  if (e.Type == "initialized") {
     this.button1.PerformClick();
  }
}

Option 2 (used also in the extension startup.js code):

Change the JavaScript.js code to reschedule the call if the map is not ready:

this.addTestCircles = function () {

  if (!this.map) {
    this.addListenerOnce("initialized", function(e) {
      this.addTestCircles();
    });
    return;
  }

....

}

This way you don’t have to handle the “initialized” event on the server. The client will simply call the method again when “initialized” is fired.

 

 

 

  • You must to post comments
0
0

Hi Luca,

work perfectly!

 

It would be very nice to have this “initialized” event from c#!

 

Thank you!

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.