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

MudTable: Added parameter to control column sort direction cycling asc->desc->none vs asc->desc->asc #1737

Merged
merged 2 commits into from
Jun 4, 2021
Merged

Conversation

uhfath
Copy link
Contributor

@uhfath uhfath commented Jun 1, 2021

Added a property "AllowUnsorted" to MudTable to control sorted state.
When "AllowUnsorted" is set to true (default) the behavior is same as it is now - column sort states change in order "Ascending", "Descending", "None".
But when "AllowUnsorted" is false, then when a column is clicked for sorting, the states loop between "Ascending" and "Descending" so there is always at least one sorted column used.

@uhfath
Copy link
Contributor Author

uhfath commented Jun 1, 2021

I guess the tests will succeed if #1736 will be merged. It contains a fix for that.

Comment on lines 26 to 28
if (state.SortDirection != SortDirection.None && string.IsNullOrWhiteSpace(state.SortLabel))
throw new ArgumentException("SortDirection is set but SortLabel is not");

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the ArgumentException. Let's just ignore sorting when the label isn't set, ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Removed and commited.

But I still believe this test should be enabled after other fixes are applied.
It just doesn't make sense if SortDirection is not "None" but SortLabel is null.
It's something like "sort ascending/descending by nothing".

@henon
Copy link
Collaborator

henon commented Jun 3, 2021

I guess the tests will succeed if #1736 will be merged. It contains a fix for that.

Actually the test fail is due to the ArgumentException.

MudBlazor.UnitTests.Components.TableTests.TableServerSideDataTest3
System.ArgumentException : SortDirection is set but SortLabel is not

But yeah, let's rebase onto dev to see if it makes a difference.

@uhfath uhfath requested a review from henon June 4, 2021 05:27
@henon henon merged commit d00d19b into MudBlazor:dev Jun 4, 2021
@henon
Copy link
Collaborator

henon commented Jun 4, 2021

Thanks

@henon henon added this to the 5.0.11 milestone Jun 4, 2021
@henon henon changed the title MudTable: Added ability to control column sorting directions ("Ascending", "Descending", "None") MudTable: Added parameter to control column sort direction cycling asc->desc->none vs asc->desc->asc Jun 4, 2021
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

Successfully merging this pull request may close these issues.

2 participants