Sorting table by columns

keevitaja -
2 years ago

I have fields name and slug, but i can only sort by slug. Name is translatable, slug is not.

protected $columns = [
'name', 'slug'
];

ryanthompson -
2 years ago

Ya the table builders don't currently automate sorting by translatable out of the box because joining automatically can be dangerous. You can achieve this manually by defining 'sort_column' parameter for the column and making sure the column is defined in the query using 'onQuerying'.