A
A
Artur Kosikov2018-11-29 14:48:22
Yii
Artur Kosikov, 2018-11-29 14:48:22

How to remove per_page parameter from URL?

Good afternoon everyone!
I use ActiveDataProvider like this:

$dataProvider = new ActiveDataProvider([
      'query' => $query,
      'pagination' => [
        'pageSize' => 100,
      ],
    ]);

There is a rule in urlManager configs:
[ 'pattern' => 'vendors/page/<page:\d+>', 'route'  => 'vendors/index', 'suffix'=>'/'],

Problem:
The paginator widget adds a GET parameter to links: /vendors/page/3/ ?per-page=100
If you write 'pageSize' => 20, then the parameter is not added. (I understand that this is the default)
If you access the URL without a parameter, i.e. like this: /vendors/page/3/ , then everything works as it should - it gives a portion of 100 entries.
How can I remove the per-page parameter from the links generated by the pagination widget?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-11-29
@atillus

Good afternoon.

'pagination' => [
    'pageSize' => 100,
    'pageSizeParam' => false
 ],

And reload the page.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question