Sorting table by columns

keevitaja - 6 months ago

On what it depends, if table can be ordered by a column?

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

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

ryanthompson - 6 months 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'.