-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Wrong DataProvider->totalCount #17093
Comments
What is the AR storage you are using? |
Is here any reason you don't use config to set I think we should block any changes in |
MySQL
Supposing you refer to app config, the reason is
...or delay calculating and setting |
No proplem:
Just let the framework take care about this. It makes sense but in current case you can get exactly what you want by making up right config before ActiveDataProvider initialization. |
Discussed the case in private messages with @GHopperMSK. He has a good solution for it. |
@GHopperMSK 's solution works, of course :-), and I'm refactoring this way. |
Unfortunately, my solution isn't good at all. Here are a few cases:
Next code works fine:
But if we just swap two lines, it will break:
|
Looks like we need to revert e162386#diff-3a9563dfdfd2448d1b7edfad3ec14522 |
I tryed to fix in #17132 |
This is limiting us to move to 2.0.16 :( How can I help to fix this one? |
Wrong DataProvider->totalCount
What steps will reproduce the problem?
What is the expected result?
totalCount should be set only when DataProvider gets to be used to fetch and render data.
Up to version 12.0.15 DataProvider pagination could be invoked and set before setting all its query conditions and afterwards totalCount was calculated correctly as expected.
What do you get instead?
DataProvider totalCount is wrong - total number of rows in the table!! - doesn't care about query conditions added after invoking $dataProvider->pagination.
Additional info
Related issue: #16891
The text was updated successfully, but these errors were encountered: