The Python Oracle

Dash Leaflet click_feature event

Become part or hire the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

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

--

Chapters
00:00 Question
02:27 Accepted answer
02:56 Thank you

--

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.