I’ve a table with a status_id field. This status_id rerences a static array similar to this one:
[
1 => 'Status 1',
2 => 'Status 2',
3 => 'Status 3'
]
I want to allow column ordering at GridView level. I’ve added a column called “statusName” and a method “getStatusName” that select the name of the status from the array. At data provider config I’ve added this:
'statusName' => [
'asc' => ['status_id' => SORT_ASC],
'desc' => ['status_id' => SORT_DESC],
'label' => Yii::t('app', 'Status'),
'default' => SORT_ASC
]
to allow sorting, but as I’m using status_id it’s ordering by this integer and not the string representation. Is there any way to tell data provider how to order this kind of id=>value array columns?