F
Filament13mo ago
현수

How do I add modal action to TableWidget like Resource?

I can open the modal window with the code below in the resource
class UserResource extends Resource
{
public static function table(Table $table): Table
{
return $table
// columns, filters...
->actions([
Tables\Actions\Action::make('testAction')
->form([
TextInput::make('testField')
]),
]);
}
}
class UserResource extends Resource
{
public static function table(Table $table): Table
{
return $table
// columns, filters...
->actions([
Tables\Actions\Action::make('testAction')
->form([
TextInput::make('testField')
]),
]);
}
}
But I can't open modals with the code below in the table widget
use Filament\Widgets\TableWidget as BaseWidget;
class MyTableWidget extends BaseWidget
{
public function table(Table $table): Table
{
return $table
->query(MyModel::query())
// columns...
->actions([
Tables\Actions\Action::make('testAction')
->form([
TextInput::make('testField')
]),
]);
}
}
use Filament\Widgets\TableWidget as BaseWidget;
class MyTableWidget extends BaseWidget
{
public function table(Table $table): Table
{
return $table
->query(MyModel::query())
// columns...
->actions([
Tables\Actions\Action::make('testAction')
->form([
TextInput::make('testField')
]),
]);
}
}
I probably don't know much about the difference between Row action and basic action.......... Please let me know if there is a way to launch the modal window in TableWidget
Solution:
This was the problem. ```php public function getTableRecordKey(Model $record): string {...
Jump to solution
1 Reply
Solution
현수
현수13mo ago
This was the problem.
public function getTableRecordKey(Model $record): string
{
// return uniqid();
return $record->id;
}
public function getTableRecordKey(Model $record): string
{
// return uniqid();
return $record->id;
}
Want results from more Discord servers?
Add your server