Looking at this article http://www.yiiframework.com/doc/api/1.1/CSort
It shows that you can sort columns that are a 'virtial'
In my GridView I have
'columns' => [
[
'label' => 'Name',
'attribute' => 'displaynamehtml',
'format' => 'raw'
],
'displaynameashtml' is an attribute that combines a first_name and last_name and creates a clickable URL.
To sort this I have:
$dataProvider->setSort([
'attributes' => [
'displaynamehtml' => [
'asc' => 'first_name, last_name',
'desc' => 'first_name DESC, last_name DESC',
'label' => 'Name'
],
However this does not work and gives me the error 'Invalid argument supplied for foreach()'
Any ideas what is wrong?