Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: GRIDFIELD - fixing error interaction between limit and itemsPerPage #11233

Closed
wants to merge 1 commit into from

Conversation

sunnysideup
Copy link
Contributor

@sunnysideup sunnysideup commented May 11, 2024

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.

image

image

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

  • Set up ModelAdmin with DataList
  • Limit the Datalist to 3 Items (using getList for example)
  • Review outcome in ModelAdmin

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.

  • The target branch is correct
  • All commits are relevant to the purpose of the PR (e.g. no debug statements, unrelated refactoring, or arbitrary linting)
    • Small amounts of additional linting are usually okay, but if it makes it hard to concentrate on the relevant changes, ask for the unrelated changes to be reverted, and submitted as a separate PR.
  • The commit messages follow our commit message guidelines
  • The PR follows our contribution guidelines
  • Code changes follow our coding conventions
  • This change is covered with tests (or tests aren't necessary for this change)
  • Any relevant User Help/Developer documentation is updated; for impactful changes, information is added to the changelog for the intended release
  • CI is green

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 override the limit, but should not do so if the limit is less than the items per page.
@GuySartorelli
Copy link
Member

You seem to have removed the pull request template from the description when you created this. I've added it back.
Please fill in the pull request template in full, including linking to an issue and creating a new issue if one doesn't exist yet.

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.

If by this you mean you aren't able to commit to making changes when they're requested, please just close this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants