所以我发现了这个: 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;
}
是否可以通过名称may或日期而不仅仅是id来显示此命令?
答案 0 :(得分:0)
$data = new CActiveDataProvider(get_class($this), array(
'sort'=>array(
'defaultOrder'=>'name ASC',
)
));