Answer the question
In order to leave comments, you need to log in
How to implement data output by the yii2 LinkPager widget according to a certain criterion?
There is a LinkPager widget and Yii2. The widget displays multiple entries per page. The rest is paginated.
How can I make it show posts only with the selected criteria?
For example, according to the filled field "publication"? If the value is 1, then outputs. If there is no value, then it does not display.
Answer the question
In order to leave comments, you need to log in
Initially, the paginator code in the controller was like this:
public function actionIndex()
{
$query = Orders::find();
$pagination = new Pagination([
'defaultPageSize' => 5,
'totalCount' => $query->count(),
]);
$orderies = $query->orderBy('id')
->offset($pagination->offset)
->limit($pagination->limit)
->all();
return $this->render('index', [
'orderies' => $orderies,
'pagination' => $pagination,
]);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question