I have a map with multiple markers.
I have a click event set on the markers which toggles a value in a database record between 0 and x (typically 1 - 30)
I have this working without problem.
However the color of the map pin should change from it's default blue to red (coded using Leaflet color attribute based on value of data element ). This works on page refresh so code is ok.
However i don't see a way to refresh the marker/ markers without refreshing the entire page which i don't want to do.
Can it be done, i expected a "marker refresh" action to be available but don't see one
Think i probably having a brief moment of stupidity here (again). Not near computer but i assume a simple server connection reload would trigger a map refresh. Will check tomorrow.
for info, this is what i am trying to achieve, currently using custom .js (with diagnostic notifications on). Blue means properties in that postal area unselected, red means selected
Just to confirm what you are trying to achieve.
On click you update the database record and change the value used in the Color option of the marker, then you reload the markers data source but the marker color does not change?
No, the click action causes a database update.
Each post area has a field with the count of the houses in the area and a selected flag
When the marker is clicked, a database update toggles that the postcode to be included/ excluded from the group
The data query returns either 0 or the count of houses in the post code area, dependent on status, selected or not.
Sample data
Yes, i am.
Click runs a flow to call database update then reload the data.
Ideally i want to run a leafletmap.refresh() on success of the data load which i am having to do with custom .js
Was hoping for a native Wappler way of doing this as the data load does not seem to automatically trigger a map refresh.
Thanks Franse
That's what i am doing now and it does remove the need for the wait but i hoped to remove the need to run the custom .js to refresh the map , a leaflet map refresh action seems a huge omission in my opinion or alternatively should the map not refresh automatically on data change, i suspect that is the correct course and probably the easiest change to the leaflet maps behaviour to force re-rendering