Hi guys,
when I do paging and address put the number of results on the page
, how can I remove
it from the address? thank you
Hi guys,
when I do paging and address put the number of results on the page
, how can I remove
it from the address? thank you
show your link or code that generates this url
My code is standart for pagination in controller
$pages = new Pagination(['totalCount' => count($allIds), 'pageSize' => Yii::$app->params['paging']]);
and in the view
LinkPager::widget([
'pagination' => $pages,
'options' => [
'id' => 'pagination'
],
'linkOptions' => [
'class' => 'page'
],
]);
?>
Set [font="Courier New"]forcePageParam[/font] to false and try:
$pages = new Pagination([
'totalCount' => count($allIds),
'pageSize' => Yii::$app->params['paging'],
'forcePageParam' => false
]);
I tried with
, but it is still the same as
I think you may need to extend the class. It seems to hide the parameter only if page = 0 and forcePageParam = false.
if ($page > 0 || $page >= 0 && $this->forcePageParam) {
$params[$this->pageParam] = $page + 1;
} else {
unset($params[$this->pageParam]);
}
You should configure defaultPageSize instead of pageSize.
Thank you! That worked, but why is it necessary ?
And pagination offset Pagination class in line 286 Does not return the correct result.
Calculating item offset for pagination why not is
offset = (page - 1) * itemsPerPage + 1