F
Filament12mo ago
ciorici

Save table columns for each user

Is there a way to save the columns shown in the table builder for each user. I am using quite a large table and sometimes some users don't need all the columns. What would be a good way to save the columns individually for each user?
8 Replies
ciorici
ciorici12mo ago
Yes, I know about this functionality and it is active, but once you go away from the page the settings are lost, so I was thinking maybe there is a way to save those settings.
toeknee
toeknee12mo ago

protected function shouldPersistTableColumnSearchInSession(): bool
{
return true;
}
protected function shouldPersistTableFiltersInSession(): bool
{
return true;
}
protected function shouldPersistTableSearchInSession(): bool
{
return true;
}
protected function shouldPersistTableSortInSession(): bool
{
return true;
}

protected function shouldPersistTableColumnSearchInSession(): bool
{
return true;
}
protected function shouldPersistTableFiltersInSession(): bool
{
return true;
}
protected function shouldPersistTableSearchInSession(): bool
{
return true;
}
protected function shouldPersistTableSortInSession(): bool
{
return true;
}
ciorici
ciorici12mo ago
Thanks, that should do the trick for now! Any way to make these persistent?
toeknee
toeknee12mo ago
you mean to all resources? If so not that I know of
ciorici
ciorici12mo ago
even for each resource, these are stored into the session so the second day these settings are lost. I was thinking maybe there is a way to store them into cookies or something so they are saved for longer periods.
toeknee
toeknee12mo ago
Not as far as I am aware. You could look at putting them into user preferences table or something. But they are indeed session based.
Kenneth Sese
Kenneth Sese12mo ago
Might be a bit overkill for just saving toggled columns but #filter-sets allows users to save stuff like toggled columns into views which are saved in the database. (sorry for the self promotion…just trying to help since you’re looking for more than just persisting to session) https://filamentphp.com/plugins/filter-sets
Filament
Filter Sets by Kenneth Sese - Plugins - Filament
Filter Sets lets your users save their filters, search queries, column order, and more into easily accessible filter sets