Answer the question
In order to leave comments, you need to log in
How to override footer in Yandex Maps balloon layout?
Can't change Yandex map balloon footer template
let myBalloonFooterBodyLayout = ymaps.templateLayoutFactory.createClass(
'<input type="button" value="Выбрать" class="baloon-button">', {
build: function() {
myBalloonContentBodyLayout.superclass.build.call(this);
$('.baloon-button').on('click', function() {
console.log('Do something...');
});
}
});
let objectManager = new ymaps.ObjectManager({
clusterize: false,
gridSize: 32,
clusterDisableClickZoom: true,
contentFooterLayout: myBalloonFooterBodyLayout // переопределение footer не работает
});
map.geoObjects.add(objectManager);
objectManager.add(data['information']);
Answer the question
In order to leave comments, you need to log in
Only the footer could not be redefined, it redefined the entire balloon template, it turned out to be a couple of lines of code more
let balloonLayout = ymaps.templateLayoutFactory.createClass(
'<b>$[properties.balloonContentHeader]</b>' +
'<div>$[properties.balloonContentBody]</div>' +
'<input type="button" value="Выбрать" class="button-balloon">', {
build: function() {
balloonLayout.superclass.build.call(this);
$('.button-balloon').on('click', function() {
console.log('Do something...');
});
}
});
let objectManager = new ymaps.ObjectManager({
clusterize: false,
gridSize: 32,
clusterDisableClickZoom: true
});
objectManager.objects.options.set({
balloonContentLayout: balloonLayout
});
map.geoObjects.add(objectManager);
objectManager.add(data['information']);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question