Dustin
Chain table row actions
I have a table with 1 row actions, the goal what i want to achieve is to open the by clicking on it action, after the submit i want to open the next row action automaticly (so without clicking on the next row action).
Example of my action (see the replaceMountedTableAction)
Action::make('handle_row')->form([
Grid::make(2)->schema([
TextInput::make('rma.id')->default(function (
RmaRow $row
) {
return $row->id;
})->disabled(),
]),
])->closeModalByClickingAway(false)->action(function () {
$this->replaceMountedTableAction('handle_row', '12199');
}),
In the submit function I have implemented the replaceMountedTableAction. But that part is not working, It is showing the backdrop, but the modal is not visible.
So i tried to open a row programmaticly. That part is working well, so no issues there.
<button wire:click="replaceMountedTableAction('handle_row', '12199')">
Button
</button>
Then I tried to chain an action with another name, that part also works:
Action::make('handle_row')->form([
Grid::make(2)->schema([
TextInput::make('rma.id')->default(function (
RmaRow $row
) {
return $row->id;
})->disabled(),
]),
])->closeModalByClickingAway(false)->action(function () {
$this->replaceMountedTableAction('test', '12199');
}),
Action::make('test')->closeModalByClickingAway(false)->action(function () {
}),
So it seems like there is an issue with chaining the same action for another record. Is this a bug or not possible?2 replies
$tableSearch query string removes leading zero's
When i enter a search term like 100.100 it formats it to 100.1, when i do it with 100.101 it stays the same (what is good).
I use this code:
/**
* @var ?string
*/
#[Url]
public $tableSearch = '';
The strange part is that i use persistSearchInSession, when i remove the code above it just works with those numbers. When i add it back it removes the leading zero's, so it has to do something with the query string.
What is a solution for this?3 replies
Receive parameters from programmatic action
I call an action from a livewire component, like this:
<div wire:click="mountAction('addData', { id: {{$event['id']}} })"
And this is the method that is called:
public function addDataAction(array $options = []): Action
{
ray($options);
return Action::make('New data')->slideOver()
->form(
CustomForm::getForm([
'type' => 'activity',
]),
)
->action(function (array $arguments) {
dd('Test action called', $arguments);
});
}
I was hoping that I could receive the id as a parameter inside my addDataAction, so that I can change the form and title depending on the input. How can i receive the parameters in the method?
5 replies
Get all row data, even with fields that are not in the record/model
I have this table builder code:
return $table
->query($this->getTableEloquentQuery())
->columns([
TextColumn::make(‘column1’)->placeholder('-')->searchable(),
NumberInput::make('Amount'),
])
->actions([
Action::make('Add')
->action(function (Model $record): void {
print_r($record);
}), ]) The numberInput is a custom column that does not have a column in the database. I want to retrieve that (and all other) row values in the add action. I wonder if this is possible because you can only receive Model like data.
}), ]) The numberInput is a custom column that does not have a column in the database. I want to retrieve that (and all other) row values in the add action. I wonder if this is possible because you can only receive Model like data.
3 replies