yii打印前如何排序

how to sort before printing in yii

所以我发现了这个: How to print directly from printer with Yii?

第二个答案(带jquery的那个)是我觉得最适合我的那个 但我只想知道,有没有什么办法可以在打印前将它们整理好?例如在模型中

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,true);
    $criteria->compare('name',$this->name,true);
    $criteria->compare('date',$this->date,true);
    $criteria->compare('department_id',$this->department_id);
    $criteria->compare('section_id',$this->section_id);
    $criteria->compare('team_id',$this->team_id);
    $criteria->compare('created_date',$this->created_date,true);
    $criteria->compare('updated_date',$this->updated_date,true);

    $data = new CActiveDataProvider(get_class($this), array(
            'criteria'=>$criteria,
            'pagination'=>false,
    ));
    $_SESSION['all'] = $data;

    $data = new CActiveDataProvider(get_class($this), array(
            'pagination'=>array('pageSize'=> Yii::app()->user->getState('pageSize',
                    Yii::app()->params['defaultPageSize']),),
            'criteria'=>$criteria,
    ));
    $_SESSION['limited'] = $data;

    return $data;
}

是否可以按名称或日期而不是仅按 ID 显示?

$data = new CActiveDataProvider(get_class($this), array(
  'sort'=>array(
    'defaultOrder'=>'name ASC',
  )
));