Change marker layer's data source

2 posts, 0 answers
  1. Marc Arbesman
    Marc Arbesman avatar
    7 posts
    Member since:
    Feb 2006

    Posted 18 Jun 2014 Link to this post


    I am trying to set marks on a marker layer via JSON returned from my MVC controller.  I am capturing an onCriteriaChange event from a ListView.  In the event handler function I am try the following

    var mapData = $('#map').data('kendoMap');
            mapData.layers[1].dataSource = new{
                transport: {
                    read: {
                        url: ('@Url.Action("getMapData")'),
                        dataType: "json",
                        data: { customerId: customer.Id }

    My declaration code is 

                              center: [30.268107, -97.744821],
                              zoom: 15,
                              layers: [{
                                  type: "tile",
                                  urlTemplate: "http://#= subdomain zoom #/#= x #/#= y #.png",
                                  subdomains: ["a", "b", "c"],
                                  attribution: "© <a href=''>OpenStreetMap contributors</a>." +
                                               "Tiles courtesy of <a href=''>Andy Allan</a>"
                                  type: "marker",
                                  locationField: "latlng",
                                  titleField: "name",

    so you can see the layer already exists.  I just want to set a marker for the lat, long returned by my controller.  

    I can verify that my controller is producing JSON (see attached screenshot).   But the markers do not show. Am I doing this correctly? Any help would be appreciated.

  2. T. Tsonev
    T. Tsonev avatar
    2760 posts

    Posted 20 Jun 2014 Link to this post


    The DataSource instance can't be replaced directly as there's no suitable setDataSource method.
    We'll add such method for the next release, but in the meantime you can use the following workaround:
    mapData.layers[1].options.dataSource = new{});

    Apologies for the caused inconvenience.
    As a token of gratitude for your involvement your Telerik points have been updated.

    T. Tsonev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. UI for ASP.NET AJAX banner
Back to Top