Question

I'm trying to open a balloon of a geopoint which is not shown. The official api docs says

if the point is show then open it or it's cluster balloon

but how do I open it if it's not shown? I tried to scroll the map to it's position and then open it, but I'm still getting an error TypeError: this._Hh.getMap(...) is null when opening the balloon.

function bymShowPoint(pId)
{

    var point = bymGetPoint(pId);
    var pState = bymClusterer.getObjectState(point);

    if (!pState.isShown)
    {

        bymScrollToPoint(pId);

    }

    if (pState.isClustered)
    {

        pState.cluster.state.set('activeObject',point);
        pState.cluster.balloon.open();

    }

    else
    {

        point.balloon.open();

    }

}
Was it helpful?

Solution

The API doesn't let you to open a non-visible point's balloon if the point is in a cluster. The way I've solved it (with the help of the yandex community) is:

  1. open the map's balloon at the point's position with the point's data
  2. remove the point from the clusterer (to hide the icon)
  3. on the map's event balloonclose add the removed point to the clusterer
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top