This is a migrated thread and some comments may be shown as answers.

Generating markers with grid's datasource

1 Answer 120 Views
Map
This is a migrated thread and some comments may be shown as answers.
Aitor
Top achievements
Rank 1
Aitor asked on 16 Feb 2016, 07:33 AM

Hello everyone!

Is it possible to bind some of the fields in the grid´s datasource to a marker layer on a map?

For example:

For every registry in my grid, take "Text", "longitude" and "latitude" fields and bind them to a markers layer on a map, "text" being the marker's title, and ["longitude", "latitude"] being the marker's latlng.

 

Thank you in advance for your help.

 

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 18 Feb 2016, 11:26 AM
Hello,

The marker layer will normally expect the location to be available as a [lat, long] array.
We can get around that by handling the markerCreated event and setting the location there.

I've just noticed that the API reference for the Marker class is missing for some reason. Will check it out.
       markerCreated: function(e) {
          var dataItem = e.marker.dataItem;
          var location = new kendo.dataviz.map.Location(dataItem.latitude, dataItem.longitude);
          e.marker.location(location);
        }

See this snippet for an example.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Map
Asked by
Aitor
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or