Grab 🇮🇹
Grab 🇮🇹
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
Here is my full code:
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('user_id')
->columns([
...
])
->defaultSort('position')
->reorderable('position')
->reorderRecordsTriggerAction(function (Action $action, bool $isReordering, RegistrationsRelationManager $livewire)
{
$action
->button()
->label($isReordering ? 'Disable reordering' : 'Reorder');

// Access $ownerRecord using $livewire argument
$ownerRecord = $livewire->ownerRecord;
$records = $ownerRecord->registrations;

if(!$isRecording){
/* Your custom logic */
}

);
}
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('user_id')
->columns([
...
])
->defaultSort('position')
->reorderable('position')
->reorderRecordsTriggerAction(function (Action $action, bool $isReordering, RegistrationsRelationManager $livewire)
{
$action
->button()
->label($isReordering ? 'Disable reordering' : 'Reorder');

// Access $ownerRecord using $livewire argument
$ownerRecord = $livewire->ownerRecord;
$records = $ownerRecord->registrations;

if(!$isRecording){
/* Your custom logic */
}

);
}
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
in a very rough way but it works
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
it's working
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
I need to access $ownerRecord inside reorderRecordsTriggerAction()
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
Now I need only a way to pass a parameter to a new function I just developed
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
It was my fault, my action was not correct
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
Thanks a lot for your support 🫶🏻
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
Doesn't work
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
I also tried to simplify omitting $isRecording logic:
->reorderRecordsTriggerAction(
fn (Action $action, bool $isReordering) => $action
->button()
->after(function () {
CalculateRegistrationPointsByPosition::make('CalculateRegistrationPointsByPosition');
})
->label($isReordering ? 'Disable reordering' : 'Enable reordering'),
)
->reorderRecordsTriggerAction(
fn (Action $action, bool $isReordering) => $action
->button()
->after(function () {
CalculateRegistrationPointsByPosition::make('CalculateRegistrationPointsByPosition');
})
->label($isReordering ? 'Disable reordering' : 'Enable reordering'),
)
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
CalculateRegistrationPointsByPosition::make('CalculateRegistrationPointsByPosition');
CalculateRegistrationPointsByPosition::make('CalculateRegistrationPointsByPosition');
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
With this code reordering default behavior works but it seems that this action is not executed:
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
->reorderRecordsTriggerAction(
fn (TableAction $action, bool $isReordering) => $action
->button()
->after(function ($isReordering) {
if (! $isReordering) {
CalculateRegistrationPointsByPosition::make('CalculateRegistrationPointsByPosition');
}
})
->label($isReordering ? 'Disable reordering' : 'Enable reordering'),
)
->reorderRecordsTriggerAction(
fn (TableAction $action, bool $isReordering) => $action
->button()
->after(function ($isReordering) {
if (! $isReordering) {
CalculateRegistrationPointsByPosition::make('CalculateRegistrationPointsByPosition');
}
})
->label($isReordering ? 'Disable reordering' : 'Enable reordering'),
)
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
We are quite there
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
When I click Reorder nothing happen, reordering with drag & drop doesn't start
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
I tried this implemetation adding $reordering var inside action function but it doesn't work
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
->reorderRecordsTriggerAction( fn (TableAction $action, bool $isReordering) => $action ->action(function ($isReordering){ if (! $isReordering) { CalculateRegistrationPointsByPosition::make('CalculateRegistrationPointsByPosition'); } } ) ->button() ->label($isReordering ? 'End reordering' : 'Reorder'), )
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
Very interesting, I will try
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
I think this helps only to customize the button that enable reordering. Am I wrong?
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
I need to trigger an action when the user finish to reorder a table in a relation manager
33 replies
FFilament
Created by RichtheKid on 8/30/2024 in #❓┊help
How to implement action or trigger event after reordering rows in a table
I got the same question. @RichtheKid have you found a solutions?
33 replies