From 170479eb857c96d6bd78e6d2f239490aae382cda Mon Sep 17 00:00:00 2001 From: Cristian Torres Date: Mon, 22 Aug 2016 03:23:13 -0600 Subject: [PATCH] Fix on getPreviousRecordID For some reason it has been returning false then the button for previous record is disabled, so, I changed it to be exactly as ```getNextRecordID``` and it worked --- code/extensions/GridFieldBetterButtonsItemRequest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/extensions/GridFieldBetterButtonsItemRequest.php b/code/extensions/GridFieldBetterButtonsItemRequest.php index 6a6c381..16af597 100755 --- a/code/extensions/GridFieldBetterButtonsItemRequest.php +++ b/code/extensions/GridFieldBetterButtonsItemRequest.php @@ -504,9 +504,9 @@ protected function saveAndRedirect($data, $form, $redirectLink) { * @return int */ public function getPreviousRecordID() { - $map = $this->owner->gridField->getManipulatedList()->column('ID'); + $map = $this->owner->gridField->getManipulatedList()->limit(PHP_INT_MAX, 0)->column('ID'); $offset = array_search($this->owner->record->ID, $map); - return ($offset > 0) ? $map[$offset-1] : false; + return isset($map[$offset-1]) ? $map[$offset-1] : false; }