Persist toggleable column state between sessions
Hello,
It is a way to persist the toggled state of a column?
Some of my users want to see their data by default deferently from others but I cannot find a way to persist their table.
Is it possible?
9 Replies
i'm not sure if i understand your problem exactly, but is maybe this what you're looking for?
https://filamentphp.com/docs/3.x/tables/columns/getting-started#making-toggleable-columns-hidden-by-default
No:
I have a table with these data:
name | surname | created_at | updated_at
some users want to see only
name | created_at
others want to see:
name | surname | updated_at
etc...
Each user can set it via the icon on the right of the table, but as soon as, they loggout they have to set it again.
Is there a way to persist their choice?
alright now i understand what your looking for. i've done a little research on this and i haven't found a built in functionality for this use case.
what i've found is the part in the app where the visible columns are determined. that should be this method here:
https://github.com/filamentphp/filament/blob/3.x/packages/tables/src/Table/Concerns/HasColumns.php#L101
GitHub
filament/packages/tables/src/Table/Concerns/HasColumns.php at 3.x ·...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
maybe this will help you a little
Self promotion, but my plugin #kenneth-sese-advanced-tables does exactly this...let your users create whatever custom views they want. Filters, columns, reorderable columns, etc.
I hate to reopenin this, but are toggle-able states really not persistent unless using hidden by default? Seems like a frustrating experience if a user hides columns and then any refresh brings them back.
Toggled columns persist in session so refreshing is fine. The OP was referring to persisting through logout, which clears the session.
Hmm, mine aren’t persisting on refresh. Will open a separate thread for that
any update?
is there a way to get the state of the toggleable column state so I can save it in the cache?
Only solution I found
then