Answer the question
In order to leave comments, you need to log in
How to sort and select the number of items in a Yii2 Listview?
I am making a book catalog. I have a filter, as well as sorting and selecting the number of records to show, and they are in different forms.
<?= $this->render('_sort', [
'sort' => $sort,
]); ?>
<?= ListView::widget([
'dataProvider' => $dataProvider,
'options' => [
'tag' => 'div',
'class' => 'row',
],
'summaryOptions' => [
'tag' => 'span',
'class' => 'col-12'
],
'itemOptions' => [
'tag' => 'div',
'class' => 'col-lg-4 col-md-4 col-sm-6 col-12 match-height-activation',
],
'itemView' => function ($model, $key, $index, $widget) use ($user, $category, $genres, $statuses) {
return $this->render('_list', [
'model' => $model,
'user' => $user,
'category' => $category,
'genres' => $genres,
'statuses' => $statuses,
]);
},
'pager' => [
'maxButtonCount' => 5,
'options' => [
'class' => 'col-12 wn__pagination',
]
],
]);?>
<?= $this->render('_search', [
'model' => $searchModel,
'categories' => $categories,
'genresInput' => $genresInput,
'tags' => $tags,
'books' => $books,
'tags_id' => $tags_id,
'user' => $user,
]); ?>
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