I have drop-down control that is used for filtering collection of custom location items in my view model (this items represent pins on map). Initially, when my collection is not filtered map is rendered as it should be and everything works fine. However when I select some value from drop-down which returns filtered collection from server, even if item collection count changes in binding part of control, location items are not filtered on map. How can I update map/pins?
After selecting some value from drop-down list, item count in (Model.Locations
.BindTo<ContactInfo, Marker>(Model.Locations, mappings => mappings.For is changed as it should be, but it doesn't filter pins on the map accordingly.
Hello,
I have drop-down control that is used for filtering collection of custom location items in my view model (this items represent pins on map). Initially, when my collection is not filtered map is rendered as it should be and everything works fine. However when I select some value from drop-down which returns filtered collection from server, even if item collection count changes in binding part of control, location items are not filtered on map. How can I update map/pins?
This is how I bind markers to my model.
Html.GoogleMap() .Name("map") .ApiKey("AIzaSyBQ3IWXop8QdYoh33And-O37MEmSOHPjR0") .MapTypeControlVisible(false) .StreetViewControlVisible(true) .FitToMarkersBounds(true) .MapTypeId(MapType.Roadmap) .Zoom(3) .MinZoom(3) .MaxZoom(20) .OverviewMapControlVisible(false) .PanControlVisible(false) .Height(600) .Center(c => c.Latitude(23).Longitude(-82)) .EnableMarkersClustering(options => { options.MaxZoom = 8; options.GridSize = 60; options.AverageCenter = true; options.ZoomOnClick = true; //options.HideSingleGroupMarker = false; options.CustomStyles(style => style.Add().ImageUrl("~/Images/logo.png").Height(70).Width(180).FontSize(1).FontColor(Color.White)); }) .BindTo<ContactInfo, Marker> (Model.Locations, mappings => mappings.For<ContactInfo> ( binding => binding.ItemDataBound ( (marker, contactInfo) => { marker.Latitude = contactInfo.Latitude; marker.Longitude = contactInfo.Longitude; marker.Address = contactInfo.Address; //marker.Icon = new MarkerImage(Url.Content("~/Images/flag-icon.png", true), new Size(48, 48), new Point(0, 0), new Point(0, 12)); marker.Window = new InfoWindow(marker) { Template = { Content = () => ViewContext.Writer.Write(string.Format("{0}<BR/>{1}<BR/>{2}<BR/>{3}", contactInfo.Address, contactInfo.Country, contactInfo.Email, contactInfo.Phone)) } }; } ) ) ) .ClientEvents(events => events.OnMapLoaded("onMapLoadHandler") .OnZoomChanged("onZoomChangedHandler"))
After selecting some value from drop-down list, item count in (Model.Locations .BindTo<ContactInfo, Marker>(Model.Locations, mappings => mappings.For is changed as it should be, but it doesn't filter pins on the map accordingly.
Can you please help me?
Thanks, Bojan