我很想在 YII 视图中按降序显示一些数据。我如何默认按 studentID desc 对数据进行排序?
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id' => 'student-grid',
'criteria'=>array(
'order'=>'StudentID DESC',
),
'dataProvider' => Agent::getStudents($model->agent_id),
'columns' => array(
'StudentID',
'first_name',
'last_name',
'dob',
'gender',
array(
'header' => 'Options',
'class' => 'CButtonColumn',
'template'=>'{View}',
'buttons'=>array(
'View' => array(
'url'=> 'Yii::app()->createUrl("/students/view/" . $data->StudentID)',
),
),
),
),
)); ?>
谢谢抗体