mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Ensuring pagination buttons have a consistent state to work off of (#8957)
This commit is contained in:
parent
8ee50d2ba7
commit
856e841955
@ -513,9 +513,12 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
|
||||
private function getAdjacentRecordID($offset)
|
||||
{
|
||||
$gridField = $this->getGridField();
|
||||
$gridStateStr = $this->getRequest()->requestVar('gridState');
|
||||
$list = $gridField->getManipulatedList();
|
||||
$state = $gridField->getState(false);
|
||||
$gridStateStr = $this->getRequest()->requestVar('gridState');
|
||||
if (!empty($gridStateStr)) {
|
||||
$state->setValue($gridStateStr);
|
||||
}
|
||||
$data = $state->getData();
|
||||
$paginator = $data->getData('GridFieldPaginator');
|
||||
if (!$paginator) {
|
||||
@ -528,7 +531,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
|
||||
$limit = $itemsPerPage + 2;
|
||||
$limitOffset = max(0, $itemsPerPage * ($currentPage-1) -1);
|
||||
|
||||
$map = $gridField->getManipulatedList()->limit($limit, $limitOffset)->column('ID');
|
||||
$map = $list->limit($limit, $limitOffset)->column('ID');
|
||||
$index = array_search($this->record->ID, $map);
|
||||
return isset($map[$index+$offset]) ? $map[$index+$offset] : false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user