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

[Bug][Grid] Unable to disable pagination #27

Open
igormukhingmailcom opened this issue Nov 8, 2019 · 6 comments
Open

[Bug][Grid] Unable to disable pagination #27

igormukhingmailcom opened this issue Nov 8, 2019 · 6 comments

Comments

@igormukhingmailcom
Copy link

Sylius version affected: 1.6 (at least since 1.4 affected)

Description
Here in docs we can see that:

sylius_grid:
        grids:
            app_admin_supplier:
                limits: [30, 12, 48]
...

In order to turn it off, configure limits: ~.

But that's not true. It passing tests (it_has_no_pagination_limits_by_default) that checks it should be without pagination by default, but in fact, even we pass limits: [] it replaced by defaults from Configuration.php I guess...

TLDR
Tried:

  • Omitting it
  • limits: ~
  • limits: null
  • limits: []
    with no success.

It can be only array as I can see here.

And as far as option have default value, ArrayToDefinitionConverter always see key exists so pagination is always active.

Steps to reproduce
Define your grid with limits: ~ or any of tried definitions and see that pagination still exists.

Possible Solution
Not sure...
But expecting support of [] and ifTrue(is_array(..) && is_empty(..)) -> thenUnset...
And probably treatFalseLike([])...

Workaround for devs who faced issue until it fixed

Something like:

limits: [1000]
@vvasiloi
Copy link
Contributor

vvasiloi commented Nov 9, 2019

Did you try this?
https://docs.sylius.com/en/latest/components_and_bundles/bundles/SyliusResourceBundle/index_resources.html#disabling-pagination-getting-a-simple-collection

@igormukhingmailcom
Copy link
Author

Thank you for a hint, @vvasiloi

@lchrusciel lchrusciel transferred this issue from Sylius/Sylius Nov 10, 2019
@igormukhingmailcom
Copy link
Author

@vvasiloi Tried that, with no success. I think that the reason is described here: Sylius/SyliusResourceBundle@9d0a62f#diff-65e50375d85391f98eb10c4d1edaa144R90 and it have sense from that point of view (deny to load 1 000 000 records per time to not break server), but from other side, after that change, there are no chance to create not limited list - we only can limit it to some big amount, like 1000 at grid which will be not what we expect if we will have 1001+ records... And if so, we should change docs:

  • Remove line about limits: ~ making removing pagination
  • Note that even big limit at route will be limited to maximum of limits of grid or so

Providing limits: ~ to grid and paginate: false for route throw LessThan1MaxPerPageException, btw.

@vvasiloi
Copy link
Contributor

@igormukhingmailcom So the constraint is in the Resource Bundle and not in Grid Bundle?

@vvasiloi
Copy link
Contributor

Looks like the Grid Bundle is not using the limits at all.
Even worse, all data sources are returning a Pagerfanta instance, which is a paginator, so there's no way to skip the pagination without writing your own data sources.

@umpirsky
Copy link

umpirsky commented Jun 21, 2023

There is a workaround: limits: [!php/const PHP_INT_MAX] 😈

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

No branches or pull requests

3 participants