The Python Oracle

Dash Leaflet click_feature event

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Secret Catacombs

--

Chapters
00:00 Dash Leaflet Click_feature Event
01:56 Accepted Answer Score 1
02:17 Thank you

--

Full question
https://stackoverflow.com/questions/7297...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #leaflet #plotlydash #geopandas #dashleaflet

#avk47



ACCEPTED ANSWER

Score 1


In Dash, a callback is only invoked when a property changes. If you click the same feature twice, the click_feature property doesn't change, and the callback is thus not invoked. If you want to invoke the callback on every click, you can target the n_clicks property - it is incremented on (every) click, and the callback will thus fire on every click.