Bug #95802
open
Paginator does not respect initial limit or offset
Added by Georg Ringer over 3 years ago.
Updated 5 months ago.
Sprint Focus:
On Location Sprint
Description
If the paginator is used with an initial limit, that must be respected as well.
Given 20 records and setting $query->setLimit(10)
and having 5 items per page, only 2 pages must be shown, currently the limit is completly ignored!
Related issues
1 (1 open — 0 closed)
- Subject changed from Paginator does not respect initial limit to Paginator does not respect initial limit or offset
The problem is in TYPO3\CMS\Extbase\Pagination\QueryResultPaginator. It overrides the original offset within the query of the items to be paginated. The method updatePaginatedItems should be updated as follows:
protected function updatePaginatedItems(int $limit, int $offset): void
{
$origOffset=$this->paginatedQueryResult = $this->queryResult
>getQuery()>getOffset();
$this->paginatedQueryResult = $this->queryResult
->getQuery()
->setLimit($limit)
->setOffset($origOffset+$offset)
->execute();
}
I have tested it and it works perfectly for offset and limit
- Sprint Focus set to On Location Sprint
- Status changed from Accepted to Under Review
- Related to Bug #94965: QueryResultPaginator override current limit/offset added
- Status changed from Under Review to Closed
- Status changed from Closed to Under Review
Also available in: Atom
PDF