Open tractorcow opened 5 years ago
@tractorcow Just noticed a similar kind of issue. I was using a nested gridfield, and somehow it seems the state for that gridfield is not saved properly. therefore, everything works fine on the first page for prev/next, but after the first page, it breaks quite badly. I've stumbled upon this when implementing save and next and prev and next in my https://github.com/lekoala/silverstripe-cms-actions/commit/9447cfa9e505251447035b2e212f94c69dcba601. I ended up giving up tracking why the state is not set properly and implementing my own prev/next method on the dataobject.
at least my buttons are working, even if the prev/next arrow are still broken :-)
Affected Version
4.4, possibly 4.3
Description
According to https://github.com/silverstripe/silverstripe-framework/issues/8951, the previous / next buttons were intentionally disabled on gridfields without paginator. However, the calculations for getAdjacentRecordID are unnecessarily dependant on paginator in the first place. For small lists (such as fields in a form) that do not require pagination, it should be simple to treat the data list as a single page with page size = record list count.
Instead getAdjacentRecord refuses to calculate adjacent ID unless there's a paginator, resulting in no pagination controls at all.
Steps to Reproduce
Add a modeladmin without paginator for any class.
Edit a record, and there will be no prev / next button.