FIX: GRIDFIELD - fixing error interaction between limit and itemsPerPage #11233
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
If the total list has less than the items per page you need to make sure that you set the items per page to be the total number of items otherwise, you still get for example 20 items in the gridfield, but the paginator info will say 1 of 1. Basically, the paginator overrides the limit / total amount of items, but instead the paginator limit should be equal to the total number available in the full list (in this case).
This is all the work I can do on this ticket. Please use the code if you like or, if not, someone else can pick up the ticket from here and make it their commit.
I understand that perhaps you should not be allowed to limit a list for ModelAdmin, but I feel there is value in doing so. I could be wrong. Maybe we could start with some feedback on this first.
Manual testing steps
Issues
See above
Pull request checklist
I don't have time to double-check this. This is a best effort approach. Lets first consider if this is worthwhile at all.
Also, as I have said before, if you find that I create more noise than help then just auto-delete any issues / commits I post. I am very happy for you to do so as it would save me the effort of posting it at all. However, I do not have enough time to follow through on all of this (as no one pays me for this time and I still have to provide for my family) so it has to be a halfway house.