N
N
nadirq2014-08-10 23:09:07
Yandex
nadirq, 2014-08-10 23:09:07

How to get the contents of the opened balloon in Yandex Maps?

I have a map where users can add their labels. The data on the labels (the contents of the balloon, coordinates, etc.) I write to the database. I also attach photos to the label by id.
And on the other map, the task is to get the id of the label that the user clicked on.
I'm passing the label id in the input hidden directly to the balloon. Now I need to get the contents of the balloon, and there, by id, find the photos attached to this place. This is a very bad idea, but I can't think of anything else yet.
Advise something, otherwise I'm tired of bydlokodit =(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Petrov, 2014-08-10
@nadirq

1. It is easier to save the tag id either as a regular marker parameter when it is created, or using a closure.
2. To display the content associated with the placemark in the balloon, you just need to use properties when creating the Placemark (see the second line and the name of the parameters in the table).
3. Do I need to upload the data first? When clicking on a marker by its id, we make a request. And how it is implemented - there is an example in the sandbox . Let's look at the example line:

placemark.properties.set('balloonContent', newContent);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question