Generating markers with grid's datasource

2 posts, 0 answers
  1. Aitor
    Aitor avatar
    1 posts
    Member since:
    Feb 2016

    Posted 16 Feb Link to this post

    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.

     

  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2771 posts

    Posted 18 Feb Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top