S
S
Stanislav2020-10-13 14:36:42
Yandex maps
Stanislav, 2020-10-13 14:36:42

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']);


Full code https://jsbin.com

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav, 2020-10-14
@Chebaa

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 question

Ask a Question

731 491 924 answers to any question