Updating datasource

5 posts, 0 answers
  1. arno
    arno avatar
    14 posts
    Member since:
    Jun 2014

    Posted 30 Sep 2015 Link to this post


    What is the most efficient way to update the map layer datasource? For this map I use a url I'd like updated (because a get parameter changes).

    I read this: http://d585tldpucybw.cloudfront.net/forums/change-marker-layer%27s-data-source

    But it's outdated, currently there is no more _initDataSource() and the setDataSource() did find its way to the layer object but I can't get it to work:

    don't find an example for it.

     also, I tried:

    var layer = $("#selectionMap").data("kendoMap").layers[0];
    layer.dataSource.transport ={read:$scope.baseUrl+"/MapStatistics"+"?countryvar="+$scope.ui.subSelections.countryVar};

     Also tried this:

    layer.setDataSource({type: "geojson",transport: {read:$scope.baseUrl+"/MapStatistics"+"?countryvar="+$scope.ui.subSelections.countryVar}})


    Error: this.dataSource.unbind is not a function

    So my question: Is there an efficient way to do this so the map is reloaded on layer url update?




  2. arno
    arno avatar
    14 posts
    Member since:
    Jun 2014

    Posted 30 Sep 2015 in reply to arno Link to this post

    For whomever would have the same issue, the following worked for me.

    Change the layer as an option

    var map = $("#selectionMap").data("kendoMap")
    var layer = map.layers[0];
    map.setOptions({layers:[{type: "shape",dataSource: {type: "geojson",transport: {read:$scope.PythonbaseUrl+"/MapStatistics"+"?countryvar="+$scope.ui.subSelections.countryVar}}  }]})

     Then reinitialize the layers


  3. T. Tsonev
    T. Tsonev avatar
    2834 posts

    Posted 02 Oct 2015 Link to this post


    Thanks for sharing your findings with the community.

    The layer setDataSource would be our recommendation, but I see that it has some issues we need to address.
    First, it's not part of the documentation (yikes!). Second, it does require a live DataSource instance:
    var dataSource = new kendo.data.DataSource({type: "geojson", ...});

    I'll update the docs and will also amend the method to accept configuration as well to match other widgets.
    Apologies for the caused inconvenience.

    T. Tsonev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  4. K
    K avatar
    2 posts
    Member since:
    Oct 2015

    Posted 02 Jul 2018 in reply to T. Tsonev Link to this post


    Can you post the location of the documentation?  I am trying to update marker DataSource from button click event.  

    Thanks, K

  5. Alex Hajigeorgieva
    Alex Hajigeorgieva avatar
    1082 posts

    Posted 04 Jul 2018 Link to this post

    Hi, Karen,

    The Kendo UI Map MarkerLayer setDataSource() method is documented at:


    Let me know if you need further assistance.

    Kind Regards,
    Alex Hajigeorgieva
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top