F
Filament16mo ago
ejoi8

Toggle button in InfoList

How can I add toggle component to show or hide null value in InfoList? I have a lot of data row and it would be better if there is a toggle button that allow users to hide or show empty row. Currently here is my code that only hide null value.
...
TextEntry::make('name')->hidden(fn ($state) => is_array($state)),
TextEntry::make('email')->hidden(fn ($state) => is_array($state)),
TextEntry::make('phone')->hidden(fn ($state) => is_array($state)),
...
...
TextEntry::make('name')->hidden(fn ($state) => is_array($state)),
TextEntry::make('email')->hidden(fn ($state) => is_array($state)),
TextEntry::make('phone')->hidden(fn ($state) => is_array($state)),
...
How can I add toggle button to show/hide back the row.
3 Replies
Patrick Boivin
Patrick Boivin16mo ago
Is this in a Panel or on a custom Livewire component?
ejoi8
ejoi8OP16mo ago
This is in panel, no custom Livewire component involved
Patrick Boivin
Patrick Boivin16mo ago
Ok, the page class is your Livewire component in this case. I'm not sure but here's an idea you can explore: - Add a public property on the page class (e.g. $showNullEntries = false) - Toggle this property from a page action (->action(fn ($livewire) => $livewire->showNullEntries = !$livewire->showNullEntries)) - Add a check on your hidden callbacks: (->hidden(fn ($livewire) => !$livewire->showNullEntries))
Want results from more Discord servers?
Add your server