yiisoft / yii-dataview

Data widgets
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
39 stars 21 forks source link

Don't throw exception when `BaseListView::$ignoreMissingPage` is `true` and passed negative page value #224

Open vjik opened 1 week ago

samdark commented 6 days ago

Should we display 1st page in this case?

samdark commented 6 days ago

After thinking about it, negative value is not valid, not only missing so I think the option isn't about it and I'd leave it as is.

vjik commented 6 days ago

I disagree.

Throw exception in Paginator from Yii Data is OK. But GridView is other. By fact, in this case GridView is controller and uses parameters from URL. Throw PaginatorException when user manually set incorrect page in URL is not OK. GridView behavior when positive page value not exist and non-positive page value must be equal and must be determined by ignoreMissingPage parameter.

For example we have list with 3 pages. Behavior on example.com/posts?page=-1 and example.com/posts?page=99 URLs must be equal.

samdark commented 5 days ago

So... displaying 1st page in this case?

vjik commented 5 days ago

So... displaying 1st page in this case?

Depends on ignoreMissingPage value:

true — 1st page false — throw exception

samdark commented 5 days ago

Alright.