你好,我需要按ID DESC排序cgridview數據表我怎麼能這樣做?Yii CGridView按ID排序
我的錯誤代碼:
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('ID',$this->ID);
$criteria->compare('name',$this->name,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'sort'=>array(
'ID'=>array(
'desc'=>'ID DESC',
),
),
));
}