F
Filamentβ€’14mo ago
ChrisR

Can the HeaderActions be refreshed if one of them is clicked?

Given this action, that is added via an extension of EditRecord::getHeaderActions
$actions[] = Action::make('transition_to_' . $potential_state)
->eventData(['transition_to' => $potential_state])
->label(Str::title($potential_state))
->action(function (Action $action, InventoryItem $record) {
$transition_to = $action->getEventData()['transition_to'];
if ($record->state->canTransitionTo($transition_to)) {
$record->state->transitionTo($transition_to);
}
});
$actions[] = Action::make('transition_to_' . $potential_state)
->eventData(['transition_to' => $potential_state])
->label(Str::title($potential_state))
->action(function (Action $action, InventoryItem $record) {
$transition_to = $action->getEventData()['transition_to'];
if ($record->state->canTransitionTo($transition_to)) {
$record->state->transitionTo($transition_to);
}
});
Can I refresh the header actions if one of these is clicked? Or do I just need to initiate a whole page refresh via redirecting back to the same page?
3 Replies
ChrisR
ChrisROPβ€’14mo ago
I'm back to looking for a solution for this - hoping a bump will help πŸ™‚
DrByte
DrByteβ€’14mo ago
I've seen it done with something like clicking to "Like" a model, where things related to that model are updated in-place ... but haven't explored updating Header Action buttons. But the button is a LW component, right? Maybe some source-diving will reveal what can be done, or what needs to be changed in the component's template to allow it to be done.
Daniel
Danielβ€’9mo ago
same question here. it seems like clicking a header action only shows a spinner for the first click but not for any further clicks
Want results from more Discord servers?
Add your server