Reputation: 71
How to use multiple paginations in controller ? I encountered the following error.
Setting unknown property: yii\widgets\LinkPager::expertpagination
in controller :
$count=$query_comment->count();
$pagination=new Pagination(['totalCount' => $count, 'defaultPageSize' => 2]);
$models_comment = $query_comment->offset($pagination->offset)
->limit($pagination->limit)
->all();
$count_expert=$query_expert->count();
$expertpagination=new Pagination(['totalCount' => $count_expert, 'defaultPageSize' => 2]);
$models_expert = $query_expert->offset($expertpagination->offset)
->limit($expertpagination->limit)
->asArray()->all();
return $this->render('product',['id'=>$id,
'table_name' => $table_name ,
'models2'=>$models2,
'models3'=>$models3,
'pagination'=>$pagination,
'expertpagination'=>$expertpagination,
'models_comment' => $models_comment ,
'model_expert' => $model_expert ,
'models_expert' => $models_expert
]);
Upvotes: 1
Views: 136
Reputation: 133400
The property always has the same name is the content that change then:
<?php
echo LinkPager::widget([ 'pagination' => $expertpagination, ]);
?>
and
<?php
echo LinkPager::widget([ 'pagination' => $pagination, ]);
?>
Upvotes: 1