Skip to content

DataGrid: Make RowsPerPage two-way bindable#8033

Merged
ScarletKuro merged 4 commits intoMudBlazor:devfrom
BossManta:fix/datagrid-rows-per-page-binding
Jan 14, 2024
Merged

DataGrid: Make RowsPerPage two-way bindable#8033
ScarletKuro merged 4 commits intoMudBlazor:devfrom
BossManta:fix/datagrid-rows-per-page-binding

Conversation

@BossManta
Copy link
Contributor

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@github-actions github-actions bot added bug Unexpected behavior or functionality not working as intended PR: needs review labels Jan 13, 2024
@ScarletKuro
Copy link
Member

ScarletKuro commented Jan 14, 2024

@henon is this a "bug" or rather a new feature?

It would be nice if you include a test to our unit tests.

@henon
Copy link
Contributor

henon commented Jan 14, 2024

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.

@henon henon added the needs: tests A maintainer has explicitly asked for associated test cases to be added to this pull request label Jan 14, 2024
@henon
Copy link
Contributor

henon commented Jan 14, 2024

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.

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.

@henon
Copy link
Contributor

henon commented Jan 14, 2024

@henon is this a "bug" or rather a new feature?

I'll flag it as an enhancement.

@henon henon added enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library and removed bug Unexpected behavior or functionality not working as intended PR: needs review labels Jan 14, 2024
@BossManta
Copy link
Contributor Author

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.

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.

Okay, I'll get on that. Sorry, should have included the test in the initial commit.

@henon
Copy link
Contributor

henon commented Jan 14, 2024

@tjscience FYI

@henon henon removed the needs: tests A maintainer has explicitly asked for associated test cases to be added to this pull request label Jan 14, 2024
@henon henon changed the title DataGrid: Fix two-way RowsPerPage binding DataGrid: Make RowsPerPage two-way bindable Jan 14, 2024
@ScarletKuro ScarletKuro merged commit 6006e67 into MudBlazor:dev Jan 14, 2024
@ScarletKuro
Copy link
Member

Thanks!

@BossManta BossManta deleted the fix/datagrid-rows-per-page-binding branch January 14, 2024 17:47
peterthorpe81 pushed a commit to peterthorpe81/MudBlazor that referenced this pull request Jan 16, 2024
biegehydra pushed a commit to biegehydra/MudBlazor that referenced this pull request Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants