defaultSort() with an enum
Using
defaultsort()
on an enum column sorts as per the enum value...but the user would be expecting it to sort on the human readable value....
is there a way of overcoming this ?Solution:Jump to solution
Ok, here is a solution, feels a bit hacky, if anyone has a better one....feel free to tell.
In the enum, add a reverse label case method:
``` public static function sortCaseSql(string $column) : string...
1 Reply
Solution
Ok, here is a solution, feels a bit hacky, if anyone has a better one....feel free to tell.
In the enum, add a reverse label case method:
In the resource, add a virtual column:
In the table, just use the virtual column as you would anyway:
and same in the table method:
->defaultSort('kb_group_label', 'asc')