Map Marker and Popup

Hello everyone,

I would like to display a popup when I click on a marker in my map. (no problem on that)

However, depending on the marker clicked, the title of my popup should be different.

Example:

click on marker 1 -> popup title = marker 1 name
click on marker 2 -> popup title = marker 2 name

Since I can't configure events but only bindings on markers, I don't know how to do it.

I'm thinking of putting a script directly on the “map” object, but I don't know how to go about it.

Thanks in advance for your help. Have a nice day!

I was working on a map a while ago with the help of @Transistor

In my understanding once you generate the markers dinamically with a binding the popups are also dinamic

image

Hm, when i click on one of this marker:
image

I want the name of the popup here:

Did you understand my problem?

So i try to it like that on my map event:

But I need “DO” to be dynamic depending on the marker I click on.

Any ideas ? Maybe by scripting insteagd of using the "popup" option ?

Maybe you can adapt this script to your needs

markers = []

for item in value:
    protoMarker = recursiveCopy(self.custom.sampleMarker)
    protoMarker['lat'] = item['latitude']
    protoMarker['lng'] = item['longitude']
    s = getStatus(item['name'])
    tecnico = getTecnico(item['name'])
    alert = getAlert(item['name'])  # Get alert status



    protoMarker['tooltip']['content']['text'] = (
        item['name'] + ': ' + statusMessages[int(s)] + ' - Tecnico: ' + tecnico
    )
    

    protoMarker['popup'] = {
        'content': {
            'text': f"<b>Name:</b> {item['name']}<br>{statusMessages[int(s)]}<br><b>Tecnico:</b> {tecnico}"
        }
    }
    
    markers.append(protoMarker)

return markers