V
V
Vladimir Pokhvalit2016-09-09 20:19:41
Yii
Vladimir Pokhvalit, 2016-09-09 20:19:41

How to make pagination in Yii2 twig using LinkPager class?

In php pagination in the template is <?php LinkPager::widget([ 'pagination' => $pages,]); ?>
put in twig template - {{ use('/yii/widgets/LinkPager') }} {{ this.widget('LinkPager', { 'pages': pages } ) }} Doesn't want to work

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2016-09-10
@slo_nik

Good afternoon.
Perhaps it would be more correct?

{{ use('/yii/widgets') }}
{{link_pager_widget({
   'pagination': dataProvider.pagination
}) }}

dataProvider in controller
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProvider->pagination->pageSize = 2;

In your case, it might be different.

V
Vladimir Pokhvalit, 2016-09-11
@mrbob100

Thank you !
Everything is very good

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question