F
Filament14mo ago
toeknee

Bug? Actions show disabled when set to hidden

Using actions on a LW Component, we have for example:
eturn Action::make('loadDraft')
->visible(fn () => MyModel::where('id', '=', $this->id)
->where('is_draft', '=', true)
->where('user_id', '=', auth()->user()?->id)->count() >= 1)
->label('Load a Draft')
->modalWidth('md')
->form([
Select::make('id')
->hiddenLabel()
->options(
MyModel::where('id', '=', $this->instance_id)
->where('is_draft', '=', true)
->where('user_id', '=', auth()->user()?->id)
->orderBy('created_at', 'desc')
->pluck('created_at', 'id')
->map(function ($item, $key) {
return $item->format('d M Y - H:i:s');
})

),
])
->action(function ($data) {
dd($date);
});
eturn Action::make('loadDraft')
->visible(fn () => MyModel::where('id', '=', $this->id)
->where('is_draft', '=', true)
->where('user_id', '=', auth()->user()?->id)->count() >= 1)
->label('Load a Draft')
->modalWidth('md')
->form([
Select::make('id')
->hiddenLabel()
->options(
MyModel::where('id', '=', $this->instance_id)
->where('is_draft', '=', true)
->where('user_id', '=', auth()->user()?->id)
->orderBy('created_at', 'desc')
->pluck('created_at', 'id')
->map(function ($item, $key) {
return $item->format('d M Y - H:i:s');
})

),
])
->action(function ($data) {
dd($date);
});
The action button shows greys out, disabled should only do that, now visible/disabled
Solution:
You should check the visibility if you are using the standalone mode https://discord.com/channels/883083792112300104/1184064527298478111/1184894000784740393...
Jump to solution
5 Replies
Solution
LeandroFerreira
LeandroFerreira14mo ago
You should check the visibility if you are using the standalone mode https://discord.com/channels/883083792112300104/1184064527298478111/1184894000784740393
Jon Mason
Jon Mason14mo ago
what is standalone mode? I'm having this same issue I think. Trying to use hidden or visible, but it's just disabling the buttons, not hiding them.
LeandroFerreira
LeandroFerreira14mo ago
Are you using the panel builder? Share your code please
toeknee
toekneeOP14mo ago
standalone means loading them into a livewire component without the panel
Jon Mason
Jon Mason14mo ago
@Leandro Ferreira I had posted about this in another thread previously: https://discord.com/channels/883083792112300104/1201257018577649664

Did you find this page helpful?