Answer the question
In order to leave comments, you need to log in
How to update balloons on Yandex map dynamically?
Site on modx, using the ajax filter snippet https://webdesign-master.ru/blog/modx/2016-05-03-m... . The filter works and filters objects (there is an identical one in the header of the site, but the objects are displayed simply in the block below), while it is disabled. But there was a task to set up the same filter for Yandex maps, filter the objects displayed on it. It always displays all objects, with any filter parameters, as I understand it, you need to somehow redraw the Yandex map with new data, otherwise it does not delete the balloon and labels, although I could be wrong. But I don't understand how to do it. I couldn't find any freelance help. Here is a link to the site arenda.shapovalovds.pp.ua/arendnyij-biznes/arendator there below is an interactive map with a filter.
Here is the map code:
ymaps.ready(init);
function init() {
var myMap = new ymaps.Map('map', {
center: [55.753994, 37.622093],
zoom: 7
});
}
ymaps.geocode('', {
results: '999'
}).then(function (res) {
// Выбираем первый результат геокодирования.
var firstGeoObject = res.geoObjects.get(0),
// Координаты геообъекта.
coords = firstGeoObject.geometry.getCoordinates(),
// Область видимости геообъекта.
bounds = firstGeoObject.properties.get('boundedBy');
firstGeoObject.options.set('preset', 'islands#darkBlueDotIconWithCaption');
// Получаем строку с адресом и выводим в иконке геообъекта.
firstGeoObject.properties.set('iconCaption', firstGeoObject.getAddressLine());
var myPlacemark = new ymaps.Placemark(coords, {
iconContent: '',
iconCaption: '',
hintContent: '',
balloonContentHeader: '<a id="asgahf" href=""></a> ',
balloonContentBody: '',
balloonContentFooter: '<div class="d-none"> | | | </div>',
balloonContent: ''
}, {
preset: 'islands#circleDotIcon',
iconColor: '#578ed8',
});
myMap.geoObjects.add(myPlacemark);
myMap.behaviors.disable('scrollZoom')
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question