2017-08-17 74 views
1

如何在控制器中使用多個分頁? 我遇到以下錯誤。Yii2多個分頁

設置未知屬性:警予\部件\ LinkPager :: expertpagination

在控制器

$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 
     ]); 
+0

顯示您的查看代碼.. – scaisEdge

+0

<?php echo LinkPager :: widget([ 'expertpagination'=> $ expertpagination, ]); ? > 和 $分頁, ]); ?> – mrreza

+0

你可以更新你的問題和廣告代碼..在評論si不可讀 – scaisEdge

回答

1

該物業始終具有相同的名稱,那麼更改內容:

 <?php 
      echo LinkPager::widget([ 'pagination' => $expertpagination, ]); 
     ?> 

 <?php 
       echo LinkPager::widget([ 'pagination' => $pagination, ]); 
     ?> 
+0

謝謝。 我的問題已解決 – mrreza