我不能在一个页面上做两个分页。我有一个标签页的形式,每个标签页有一个不同的产品列表,我想分页每个列表这里是错误代码和屏幕截图
$posts = Wishlist::find()->where(['user_id'=>$id]);
$pagination =new Pagination([
'defaultPageSize' =>10,
'totalCount' => $posts->count()
]);
$posts = $posts->offset($pagination->offset )->limit($pagination->limit)->all();
$favs = FavLists::find()->where(['user_id'=>$id]);
$pag_favs =new Pagination([
'defaultPageSize' =>10,
'totalCount' => $favs->count()
]);
$favs = $favs->offset($pag_favs->offset )->limit($pag_favs->limit)->all();
return $this->render('view', [
'model' => $this->findModel($id),
'posts' =>$posts,
'pagination' => $pagination,
'favs' =>$favs,
'pag_favs' => $pag_favs
]);
查看第一页
echo LinkPager::widget([
'pagination' => $pagination,
]);
?>
在第二页视图中
<?php
echo LinkPager::widget([
'pag_favs' => $pag_favs,
]);
?>
1条答案
按热度按时间nsc4cvqm1#
在LinkPager中将
pag_fvs
替换为分页LinkPager没有page_fvs
属性