Persist sort order
Hi. Can user selected sort be persisted on an relationshipManager table?
Thanks
Solution:Jump to solution
Maybe this functionality was added later? But this is plain Filament:
```php
// Resource class
public static function table(Table $table): Table
{...
40 Replies
Relation managers are just tables.
Yes! Filters can be persisted... but can Orders be persisted?
Maybe I’m just not understanding the difference.
A table represents the records of a model.
In my table, ther are many sortable columns. Created_at, name
User would like to see records by some sort column...
And those model can be filtered and or persisted with a url query.
for example, user A like the table sorted by name, and user B like like to see the table sorted by created_at by default
Then you need a way to track the user preferences.
filters are persisted.
it would be nice to have the sort persisted to...
I'm I telling it right?
some users would like to see created_at DESC, and some ASC... to see the last change first...
It sounds sounds like you want that at a user level though. So you need some kind of persistence at the user level to to set that via a middleware.
But that becomes an app level specification and not a filament one.
Filament is still just laravel. So however you would handle it without filament still applies.
I'm developing a process control system
Users creates "issues"
Then, an ISSUE has same Progress
User can add a comment, then attach a file, change ISSUE priority, etc.
Each actions generates a log in a table
So, the ISSUE viewPage has a relationshipManager with that log.
Here's the case... some users would like to see the log ASC, and others DESC.
So.. they select the order like this
Filter are persisted with persistFiltersInSession
Is there a persistSortsInSession ?
Not to my knowledge
so the user sees the data in the table sorted as he left it
Great!
Thank you SO MUCH for your time... really
Filament is great, takes us time to adapt, but I see it very powerfull
I meant. Filament can handle this, but you need a way to persist the user preferences which falls outside the scope of what filament does. Filament can certainly handle it. But you have to define that distinction.
Just sounds like an app specific use case to me.
But filament will let your define the query in in way you sit fit.
when I grow up, and my mind understand the core, I'll try to collaborate to add the feature
That’s kind of the beauty of it. It’s a sane default but sometimes your app needs more.
And it allows you to do it.
My advice is to remember that it’s still just laravel. And don’t get caught up in trying to do things in a filament way. You still have all the control for your apps needs.
Yes... but I need to understand the core... how to interact in Filament..
There’s nothing magical about filament. It’s just a normal laravel lifecycle.
Or livewire lifecycle
I hear you though. “Interact” can be objective, but it still just laravel and livewire.
I have projects in Laravel 5, MVC, bootstrap
Then, laravel 11 with tailwind and jetstream
then Laravel 11 with filament
somewhere was VUE and Livewire...
So many technologies...
Understandable, but that’s outside the scope of filament.
Yes! but I spent 30 minutes googling on how to access the current record to build a custom action...
I'm learning... 😄
I get it. Definitely not saying you’re doing anything wrong.
But using filament has an implied understanding of the tall stack.
I'm happy I could build the action...
And this looks good.
I'm up to it!
Don’t doubt it.
V4 will clean some of this up.
Yeah! it works! I'm very happy... but It take time to switch my mind... and understand everything... I'm gettin progress!
I do feel there’s an educational disconnect with actions currently but v4 will be better.
You’ll. Get there. But I understand the disconnect.
again.. thanks to you and all the team... now that I can tell you directly... thanks
And it’s not always easy to describe in docs. We’re doing the best we can right now.
Docs are great! clear! but we are so lazzy to read!! jajajaj
I'm visual learner... I like videos
💯 I’m the same way.
but they are all basic... I didn't find intermediate or advanced
Yea. And that’s tough.
Thanks again! I'll continue coding and let you do your stuff..
so many thanks for your time and patience!
Greatings from Argentina.
Greeting from a monsoon in Savannah ga. USA. Lol
Solution
Maybe this functionality was added later? But this is plain Filament:
Excellent!!!!