afterStateUpdated() Not Triggering in a Custom Filament Field
Thread Title:
Issue with
afterStateUpdated()
Not Triggering in a Custom Filament Field with OpenLayers
Body of the Post:
Hello everyone,
I am working with Filament to develop a form that includes an OpenLayers map. I have a custom field that allows users to select a location on the map, and I need the afterStateUpdated()
method to trigger every time the latitude or longitude is updated via a click on the map.
Here is the JavaScript snippet:
- Field Configuration in Filament: My field is configured to handle updates to these properties. However, even though the latitude
and longitude
properties update correctly, the afterStateUpdated()
method that I expect to trigger does not. Here is the relevant configuration:
Problem:
Despite the latitude and longitude properties updating correctly, the afterStateUpdated()
method does not trigger as expected. I would like this method to fire to perform additional logic every time the coordinates change through a map click.
Does anyone have experience with this kind of setup or any suggestions on how I might ensure that afterStateUpdated()
triggers correctly when updating coordinates?
I would appreciate any help or suggestions.Solution:Jump to solution
Solved, change the implementation to, and now works.
```javascript
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/ol.min.css" rel="stylesheet">...
2 Replies