Hi I would like to set a sorting to all fields in a CGridView without having to write them down manually. Any ideas?
$this->widget('application.widgets.GridView', array(
'dataProvider'=>new CArrayDataProvider($offers,array(
'sort'=>array(
'attributes'=> 'AUTOMATICALLY TAKE ALL',
),
'pagination'=>array(
'pageSize'=>10,
),
)
),
'enableSorting'=>true,
...
Now I have to write all columns(=attributes) I want to sort on. But I just want all that are defined in the grid.
You don't need asterisk feature, 'cause you can use keys from array:
$this->widget('application.widgets.GridView', array(
'dataProvider'=>new CArrayDataProvider($offers,array(
'sort'=>array(
'attributes'=> array_keys($offers[0]),
),
...