Is there a way to enable sortable on a column that is hidden?
I have a table that has a 'name' column; (in model; name concats first name and last name)
TextColumn::make('name')
->searchable(['first_name', 'last_name'])
->sortable(['last_name']),
However, requirement has come in to enable sorting by first name or last name?
I was thinking I'd add first name and last name as separate columns, enable sortable and hide them. But you can't sort by hidden columns.
(Table uses a split - so has the dropdown for picking filters; rather than clicking headers)
Can't see an obvious solution to this.... hopefully there is one ?
8 Replies
π€
close....
that hides it; but it's still taking space up in the flex
yep, it is a workaround..
indeed
you could try to fix it creating a custom theme and customizing the css π€
yeah
i'm checking with client whether separate columns is acceptable first π
thanks!
let me know if it works βοΈ
will do !
found a solution....
i grouped the 2 columns into a stack, then used the 'hidden' class hack from above.
in a stack; the hidden columns don't leave behind a gap; so think this is good