Unplanned
Last Updated: 12 Nov 2019 11:42 by ADMIN
Lee
Created on: 08 Nov 2019 15:35
Category: Map
Type: Feature Request
5
Fire event after map layers loaded.
My map takes a few seconds to load the background and all of the data points. I would like to hide it until everything is complete. Is there an event I can use similar to the grid's dataBound event so that I can add a class called "show" to the container as soon as everything is ready? 
1 comment
ADMIN
Alex Hajigeorgieva
Posted on: 12 Nov 2019 11:42

Hello, Lee,

Currently, the Kendo UI Map does not have a render/dataBound event like the Kendo UI Chart.

I have now converted this to a Feature request here so people can upvote it and added a vote on your behalf as well. Meanwhile, you could simulate the event in the following way:

  • add a change event handler to the marker dataSource and check how many markers are in the response
  • add a markerCreated event handler to the Kendo UI Map and increase the count of a variable until it reaches the response length from the previous step

 

var markersToRender = 0;
var allMarkersRendered = 0;

// marker data source change event handler
change: function(e){
   markersToRender = e.items.length;
}

// map markerCreated event handler
 markerCreated: function(e){
   allMarkersRendered +=1;
   if(markersToRender === allMarkersRendered){
     this.element.css({ opacity: 1 });
   }
}

 

Here is a runnable example for your reference:

https://dojo.telerik.com/@bubblemaster/UyiTufAN/3

Let me know what you think.

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.