Trying to accomplish a simple task, after loading I want to set the map extent based on the marker layer.
I have the code to create the extent and set it but timing is the issue. When I try to do this on document ready the layer item list is empty and there is no explicit "load" event I can attach a handler to. Firing on "reset" will cause infinite recursion since the function is itself changing the viewport of the map plus it seems to fire multiple times.
Basically, I just need to know when this should be called and how to wire a handler to do it at that time.
var map = $('#map').getKendoMap();
var layer = map.layers[1];
var markers = layer.items;
var extent;
for (var i = 0; i < markers.length; i++) {
var loc = markers[i].location();
if (!extent) {
extent = new kendo.dataviz.map.Extent(loc, loc);
} else {
extent.include(loc);
}
}
map.extent(extent);
.