The Python Oracle

Dash Leaflet click_feature event

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2

--

Chapters
00:00 Dash Leaflet Click_feature Event
01:59 Accepted Answer Score 1
02:25 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.