我在modelsearch中有以下代码用于数据的gridview显示。
public function search($params )
{
$tech=array(22,24,25,29);
$query=(new \yii\db\Query())-> select(['tbl_ticket.*',
'tbl_assignment.ticket_id',
'tbl_assignment.tech_id',
'tbl_assignment.date_time',
'tbl_techs.f_name',
'tbl_techs.loc',
'tbl_techs.attachment',
'tbl_techs.dep',
'tbl_techs.sec']);
$query->from('tbl_ticket');
$query->join('LEFT JOIN', 'tbl_assignment', 'tbl_assignment.ticket_id = tbl_ticket.id');
$query->join('LEFT JOIN', 'tbl_techs', 'tbl_techs.id = tbl_assignment.tech_id');
$query->where(['tbl_assignment.id' => $tech]);
$para = isset($_POST['Email']) ? $_POST['Email'] : $_GET['email'];
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => 5,
'params'=>array('email' => $para)
],
]);
$query->andWhere(['tbl_ticket.hd_user_email' => $para]);
if (! ($this->load($params ) && $this->validate())) {
return $dataProvider;
}
$query->andFilterWhere(array(
'id' => $this->id,
'ticket_id' => $this->ticket_id,
'tech_id' => $this->tech_id,
'date_time' => $this->date_time,
));
return $dataProvider;
}
它显示了gridview,但是当点击分页时,它显示相同的数据。是什么导致了这个错误?