Challenges with Implementing EditAction in Multi-step Process: Modal
Hey everyone,
I'm currently working on implementing an EditAction on a Widget in multiple steps, and I've hit a bit of a roadblock. Specifically, in step two, I'm aiming to overwrite some_row with new information loaded from an external API. The catch is that I want this new data to be displayed in the model so that users can edit it. Upon saving, the updated information should then be stored in the table.
I've tried a couple of approaches, but each has its own limitation:
- Using ->default(): The loaded data doesn't show up in the modal.
- Using $set closure: I can update the data, but it's not editable by the user. Furthermore, any value entered by the user in the modal doesn't affect what gets saved using the $set closure.
Here's the relevant code snippet from the second step:
Step::make('Step two') ->schema(function (Get $get, Set $set, DataService $dataService, $record) { // $set doesn't work, as the value cannot be updated by the user return [ TextInput::make('some_row') ->label('some row') ->default($dataService->getValue($record)), ]; });
0 Replies