Skip to content

Commit

Permalink
FIX Gridfiled pagination missing after search
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabina Talipova committed Jun 25, 2023
1 parent 220fee6 commit 44f2c77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Forms/GridField/GridFieldFilterHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function getManipulatedData(GridField $gridField, SS_List $dataList)

$dataListClone = clone($dataList);
$results = $this->getSearchContext($gridField)
->getQuery($filterArguments, false, false, $dataListClone);
->getQuery($filterArguments, false, null, $dataListClone);

return $results;
}
Expand Down
4 changes: 4 additions & 0 deletions src/ORM/Search/SearchContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ protected function applyBaseTableFields()
*/
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);
Expand Down Expand Up @@ -172,6 +173,9 @@ private function search(DataList $query): DataList
*/
private function prepareQuery($sort, $limit, ?DataList $existingQuery): DataList
{
if ($limit === false) {
$limit = null;
}
$query = null;
if ($existingQuery) {
if (!($existingQuery instanceof DataList)) {
Expand Down

0 comments on commit 44f2c77

Please sign in to comment.