How do I refresh select options when I generate new options within the same wizard
Hello, I love using filament so far, everything was kind of well documented to me, but currently I am stuck on the following topic ....
- I use a wizard to generate new data based on the data entered in the step before
- In a select box I want to display the generated data but the options data is not refreshed, so the users is confused
I created some dummy repo as a test case, see here https://github.com/canyoningdb/filament-question1. The major logic is in this file
https://github.com/canyoningdb/filament-question1/blob/main/app/Filament/Resources/CanyonResource/Pages/CreateCanyon.php
Big thanks for hints and help,
Max
5 Replies
You need to use a closure on the afterStateUpdated() and $set the field you which to update with the new values
Hmm, I tried to using afterStateUpdated before but it seemed not to be working. If I change afterValidation to afterStateUpdated for example even the ID of the select element is updated. How could I set the select options using $set, could you privide an example?
Did you set the field to be reactive to receive the afterStateUpdated?
$set('my_select', ['My Array of values here]);
Will do it
But looking at the above, you are trying to handle it on after updating the inputs on reactive
I am still not sure how this is working internally but the following example is working
Thanks 🙂
Ok great