FIX Gridfiled pagination missing after search (#10828)

This commit is contained in:
Sabina Talipova 2023-06-26 12:11:33 +12:00 committed by GitHub
parent fb7d2256f1
commit bb5378e177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -186,7 +186,7 @@ class GridFieldFilterHeader extends AbstractGridFieldComponent implements GridFi
$dataListClone = clone($dataList);
$results = $this->getSearchContext($gridField)
->getQuery($filterArguments, false, false, $dataListClone);
->getQuery($filterArguments, false, null, $dataListClone);
return $results;
}

View File

@ -140,6 +140,7 @@ class SearchContext
*/
public function getQuery($searchParams, $sort = false, $limit = false, $existingQuery = null)
{
// @todo In CMS 6 change method param from `$limit = false` to `array|string|null $limit = null`
$this->setSearchParams($searchParams);
$query = $this->prepareQuery($sort, $limit, $existingQuery);
return $this->search($query);
@ -172,6 +173,9 @@ class SearchContext
*/
private function prepareQuery($sort, $limit, ?DataList $existingQuery): DataList
{
if ($limit === false) {
$limit = null;
}
$query = null;
if ($existingQuery) {
if (!($existingQuery instanceof DataList)) {