Edit Action in table in custom livewire component not showing fields in modal
I'm loading a table with an action into a custom livewire page, the table loads fine and it works perfectly, but for some reason when I click the edit button (which opens a modal to edit it, since its a simple resource) the form on the modal is empty. I can set the form manually on the action and it works, but im not sure why its not loading the fields by default. It works when I do it from the specific resource page.
public function table(Table $table): Table
{
return EnvironmentConfigurationResource::table($table)->query(fn () => EnvironmentConfiguration::query());
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('key')
->label(('Key'))
->searchable(),
Tables\Columns\TextColumn::make('value')
->label(('Value'))
->searchable(),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
]);
}
Solution:Jump to solution
It's because EditAction works like normal action in custom page. you need to define forms (https://filamentphp.com/docs/3.x/actions/modals#modal-forms) and prefill data (https://filamentphp.com/docs/3.x/actions/modals#filling-the-form-with-existing-data) and lastly you need to crate your action to update the data
2 Replies
Solution
It's because EditAction works like normal action in custom page. you need to define forms (https://filamentphp.com/docs/3.x/actions/modals#modal-forms) and prefill data (https://filamentphp.com/docs/3.x/actions/modals#filling-the-form-with-existing-data) and lastly you need to crate your action to update the data
Thank you!