Answer the question
In order to leave comments, you need to log in
Why does LIstView,ActiveDataProvider pagination error occur?
Here is the controller
public function actionFilter(){
$model= new Category();
$serialQuery= Serial::find();
$ch=Yii::$app->request->post('ch1');
$ch2=Yii::$app->request->post('ch2');
$ch3=Yii::$app->request->post('ch3');
$idDate=$model->getQuery($ch,$ch2,$ch3);
$serialQuery->where(['id' => $idDate]);
$serialDataProvider = new ActiveDataProvider([
'query' => $serialQuery,
'pagination' => [
'pageSize' => 15,
],
'sort'=>[
'defaultOrder' => [
'year'=>SORT_DESC],
],
]);
return $this->render('filter', [
'productsDataProvider' => $serialDataProvider
]);
}
array(296) {
[0]=> int(1)
[1]=> int(8)
[2]=> int(9)
[3]=> int(32)
[4]=> int(38)
[5]=> int(42)
[6]=> int(43)
[7]=> int(44)
[8]=> int(48)...}
...<div class="bgx fix plitka">
<div class="kat_name fix fr"><?= Yii::t('app','VIEW_SERIAL') ?>
<div class="uk">
<a href="#" class="list_style">
<i class="fa fa-list"></i>
</a>
<a href="#" class="grid_style">
<i class="fa fa-th"></i>
</a>
</div>
</div>
<?= ListView::widget([
'dataProvider' => $productsDataProvider,
'itemView' => '_serial'
]) ?>
</div>...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question