Custom sort option
Not sure if I'm missing something but I can't find anything relevant in the docs/online
Is there a way to add a custom sort option, without having the related column appear on the table?
Eg I might want to sort by the
ID
column, without having the ID visible on the table.
I tried having a hidden column but it didn't work.
Any idea/tips?
Thanks in advanceSolution:Jump to solution
What about
```php
TextColumn::make('ID')
->toggleable(isToggledHiddenByDefault: true)...
9 Replies
Do you mean that you want to sort the table by its ID by default?
Sorry, no. I want to have an option to sort by ID without having a column visible.
Eg in the Filament demo site, I'd like this
Without having a
TextColumn::make('ID')->sortable()
From what i can see, this is not possible, but I might be missing something
Looks like you are using the grid with sortable. I don't think it's possible... Maybe if you add a hidden extra attributes class to the header and cell attributes as the code would still bring it into the sortable select.
Yeah I guess I can hide it with CSS but that's too hacky even for me haha 😂
Anyway, thank you all for your time
Solution
What about
Yeah I thought about it but for some reason doesn't work as expected in my case. The columns remain visible no matter what? Weird stuff :/
Possibly the split view/grid?
Ah shit yeah, that's it 🤦
Oh well, I'll have to look into it. I'll accept your answer since it's the most sane workaround