-
-
Notifications
You must be signed in to change notification settings - Fork 534
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
DataGrid Reading Twice When non-default PageSize changes #3610
Comments
most applicable packages updated to version 1.0.1 today. Read data still firing twice as described. |
Hello @TorreyGarland Glad you're liking our package. I am unable to reproduce the issue with our demo in rel-1.0 branch.
But only calls it once. Can you please provide a repository with the issue? Would really appreciate it, Thanks! |
https://gist.github.com/TorreyGarland/2d66f761431554e827f7213e0b3ffa9a this is my first time using Gist. One thing I forgot to add is that I was using ReactiveUI.Blazor but when I created the issue originally the ViewModel logic had nothing to do with ReadData. |
I also notice the same behavior if a value is inserted for "CurrentPage"
I thought that maybe creating an empty callback for "PageSizedChanged" might work, but it doesn't. |
Well, would have been better straight up repo, I'll create a new project and copy paste the stuff. |
Hello, |
OH wait!! I was just re-reading the steps to reproduce, I was testing by refreshing and other datagrid operations... So your problem is by changing page sizes. Well you should not show the
This way Blazor can mutate the value successfully, otherwise it's just an hardcoded value. |
@bind-page="_pageSize" works. is there a bindable property for "CurrentPage"? Setting CurrentPage="_currentPage" where _currentPage = 2 fires twice also. |
It seems we forgot to adjust this API. At the moment it is not bindable, but you can make the same thing with the manual callback.
@David-Moreira we should change the CurrentPage API in v2.0 to: |
Scheduling the work for v1.1. |
So I was starting this, and I noticed we have : We'd need to be changing it to Does that make sense at this point? I don't think the args make much sense, it only brings in the extra pagesize info, which in my opinion adds nothing to this callback, and we're loosing the Otherwise we could maintain However I'd advocate to make it cleaner and just remove the PageChanged |
That means it would be a breaking change and we would have to move it to 2.0. I think |
Better just re-schedule for 2.0 then. No point in doing anything here I guess.. EVen introducing |
Describe the bug
DataGrid "ReadData" event is called twice when it's PageSize property is set to a non-default value; in this case 10;
The datagrid currently only has a callback for the ReadData event for server-side sorting, filtering and pagination. DataGrid data is only populated from the ReadData callback.
This does not happen with the component page first loads - only after the value from the page size drop down is changed.
This also does not happen if PageSize is not set in markup.
StateHasChanged or InvokeAsync(StateHasChanged) are never explicitly invoked.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
ReadData callback fires one time if PageSize dropdown value is changed.
Notes
This a Blazor Server App, not Web Assembly.
Target Framework: net6.0
Visual Studio Enterprise 2022, version 17.0.4
All current .NET SDKs
Several custom source generators such as thisassembly installed.
Nuget Packages:
Render mode for the app is set to "Server" and not "ServerPrerendered" in _Host.cshtml because of too many issues of callbacks firing twice instead of once on initial page load.
Example Code
Markup Code
Code Behind
BTW, this is one of the best packages that I have ever used. Please keep up the good work.
The text was updated successfully, but these errors were encountered: