Setting center after remote data is being called

2 posts, 0 answers
  1. NS
    NS avatar
    179 posts
    Member since:
    Jan 2007

    Posted 29 Jul 2014 Link to this post

    Hi,
    I'm following the example "binding markers to remote data"
    My question is: is it possible to center the map programmatically after the Datasource.read is being called? My datasource contains a list of possible stores. However, I would like to center the map (add a marker) with the initial longitude/latitude of my search request?

    Next question : would it be possible (after datasource.read) to center/zoom the map around that layer?

    So my code looks more or less as follow:
     @(Html.Kendo().Map()
        .Name("map")
        .Zoom(3)
        .Layers(layers =>
        {
            layers.Add()
                .Type(MapLayerType.Tile)
                .UrlTemplateId("http://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png")
                .Subdomains("a", "b", "c")
                .Attribution("&copy; <a href='http://osm.org/copyright'>OpenStreetMap contributors</a>");

            layers.Add()
                .Type(MapLayerType.Marker)
                .DataSource(dataSource => dataSource
                      .Read(read => read.Action("_StoreLocations", "Order", new { OrderId = Request.QueryString["OrderId"] }))
                      )
                .LocationField("LatLng")

                .TitleField("Name");

        })
  2. Hristo Germanov
    Admin
    Hristo Germanov avatar
    703 posts

    Posted 30 Jul 2014 Link to this post

    Hello NS,

    I think that you need to hook up to the DataSource change event and do this logic there.

    I hope this helps.

    Regards,
    Hristo Germanov
    Telerik
     

    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 MVC is VS 2017 Ready
Back to Top