F
Filamentβ€’16mo ago
Antoine

Reset in columns toggleable?

I see that the ability to make a table's toggle clear has not been deployed? Do you know a method to reset columns toggleable to their default values? thx
10 Replies
Antoine
AntoineOPβ€’16mo ago
or a method to go back to default table?
Patrick Boivin
Patrick Boivinβ€’16mo ago
Not sure but I think the visible columns are stored in the browser local storage... maybe you can add a button in your page to clear it
Antoine
AntoineOPβ€’16mo ago
Ok, I see. But how can I get default values of these columns to inject in a new session? Thank's the response πŸ™‚
Patrick Boivin
Patrick Boivinβ€’16mo ago
Right, so it's stored in the PHP session, not local storage. Just did a quick test, this will reset to the default columns on a ListPosts page:
session()->remove('tables.ListPosts_toggled_columns');
session()->remove('tables.ListPosts_toggled_columns');
Antoine
AntoineOPβ€’16mo ago
Many thanks @pboivin and for anyone looking to reset all table action sessions through a button for example: session()->remove('tables'); Do you know if it is possible to display a button at the end of table lookup or other table actions like for a Filament::registerRenderHook() ?
Patrick Boivin
Patrick Boivinβ€’16mo ago
I'm not sure... where exactly do you want to add the button?
Antoine
AntoineOPβ€’16mo ago
I want to add a button at the end of the toggle button or filters. I searched in the documentation but Filament doesn't have renderHooks in the toolbar header table. So I created lots of simple render hooks that work like a charm in the toolbar header table. This would make Filament even more flexible but I don't know if @Dan Harrin is interested by this option. If he is interested, I propose me to make a pull request and add the renderHooks to the documentation? It's only renderHooks like this : {{ \Filament\Support\Facades\FilamentView::renderHook('panels::resource.pages.list-records.table.filters.end', scopes: $this->getRenderHookScopes()) }}
Antoine
AntoineOPβ€’16mo ago
and more...
Patrick Boivin
Patrick Boivinβ€’16mo ago
Looks good to me, I would say take a chance and send a PR πŸ˜„
BlackShadow
BlackShadowβ€’13mo ago
This would be a really nice addition to core πŸ™‚ (Just like filters adding a Reset button)
Want results from more Discord servers?
Add your server