run_layer_method
not working with multiple args for ui.leaflet
#3954
-
Below sample code works for @ui.page('/')
async def page():
map = ui.leaflet(center=(51.5, -0.1))
m = map.marker(latlng=map.center)
await map.initialized()
map.run_layer_method(m.id, 'bindPopup', 'London')
map.run_layer_method(m.id, ':on', "click", f"function(e) {{ alert(`Marker clicked at ${e.latlng.lat}, ${e.latlng.lng}`); }}") |
Beta Was this translation helpful? Give feedback.
Answered by
falkoschindler
Nov 7, 2024
Replies: 1 comment 1 reply
-
Hi @AIBappa, This line should work: map.run_layer_method(m.id, ':on', '"click"', 'function(e) { alert(`Clicked at ${e.latlng.lat}, ${e.latlng.lng}`); }')
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
AIBappa
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @AIBappa,
This line should work:
{{
and}}
with{
and}
.click
, causing an error in the developer console.