A
A
Alexander Nevsky2018-11-06 15:08:57
Yii
Alexander Nevsky, 2018-11-06 15:08:57

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,
]); ?>

I can't figure out how to sort in the kartik-v Select2 widget and select the number of records to show. And as if the 2 forms did not interfere, but simply complemented each other.
And I also try to attach Pjax there, but Select2 resists)))

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question