Is it possible to call a table action from a TextColumn cell?

I have a table in my resource with a few table actions. Is there any way to call one of the actions when the users clicks on a Tables\Columns\TextColumn cell? I have a table action named "show-message-text-modal" and I can select the table action using this closure, I just don't know how to trigger it or call it.
Tables\Columns\TextColumn::make('text')
->placeholder('No text.')
->action(function (Message $record, Table $table) {
$table->getAction('show-message-text-modal');
// I have access to the action
}),
Tables\Columns\TextColumn::make('text')
->placeholder('No text.')
->action(function (Message $record, Table $table) {
$table->getAction('show-message-text-modal');
// I have access to the action
}),
2 Replies
fsamapoor
fsamapoorOP14mo ago
I'm not sure this is a good aproach, but I made it work like this:
->action(function (Message $record, Component $livewire) {
$livewire->mountTableAction('show-message-text-modal', $record->id);
}),
->action(function (Message $record, Component $livewire) {
$livewire->mountTableAction('show-message-text-modal', $record->id);
}),
toeknee
toeknee14mo ago
Why not just do:
Tables\Columns\TextColumn::make('text')
->placeholder('No text.')
->form([
// Place holders, form view field here?
])
->action(function (Message $record, Table $table) {
$table->getAction('show-message-text-modal');
// I have access to the action
}),
Tables\Columns\TextColumn::make('text')
->placeholder('No text.')
->form([
// Place holders, form view field here?
])
->action(function (Message $record, Table $table) {
$table->getAction('show-message-text-modal');
// I have access to the action
}),
Want results from more Discord servers?
Add your server