DataGrid: Make RowsPerPage two-way bindable#8033
Conversation
|
@henon is this a "bug" or rather a new feature? It would be nice if you include a test to our unit tests. |
@BossManta Yes, it would indeed not only be nice, but also required by our rules ;). The reason is that this is the only way we can ensure stability with so many people touching the code base. |
This is exactly how you can write the test. Copy that test component and use it in a new unit test to ensure two-way binding works. |
I'll flag it as an enhancement. |
Okay, I'll get on that. Sorry, should have included the test in the initial commit. |
|
@tjscience FYI |
src/MudBlazor.UnitTests.Viewer/TestComponents/DataGrid/DataGridRowsPerPageBindingTest.razor
Outdated
Show resolved
Hide resolved
|
Thanks! |
Description
For some reason, the RowsPerPageChanged EventCallback parameter was not included in the MudDataGrid component. This is required to allow for two-way binding. This issue is related to a discussion from last year (#7677).
To resolve the issue I have included the RowsPerPageChanged EventCallback parameter in the DataGrid component. I have also included a line to invoke the callback when the RowsPerPage value is changed.
How Has This Been Tested?
I tested this change using the MudBlazor.Docs.Server project. I quickly altered one example to use two-way binding (@bind-RowsPerPage). Everything worked as expected.
Types of changes
Checklist:
dev).