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

[DataGrid] Add remove sort capability #1826

Merged
merged 4 commits into from Apr 11, 2024
Merged

Conversation

vnbaaij
Copy link
Collaborator

@vnbaaij vnbaaij commented Apr 10, 2024

Previosly when a sort was executed on a DataGrid, (by clicking on a column header button or pressing enter when the column header button is focused), there was no option to undo that.

With this PR it is now possible to right click on the sorted colum header button to clear the sort and restore it to the default/start situation. updated: or use Ctrl+Enter to remove the sorting when the column header button is focused

When a grid has not sort specified, it just goes back to its initial state. When thare was a defaut sort specified, it will be restored:

grid-sort-remove

Based on discussion in #283

@vnbaaij vnbaaij added the improvement A non-feature-adding improvement label Apr 10, 2024
@vnbaaij vnbaaij added this to the v4.6.2 milestone Apr 10, 2024
@vnbaaij vnbaaij requested a review from dvoituron April 10, 2024 22:33
@dvoituron
Copy link
Collaborator

We can have a method to "remove" the sort order, but :

  1. It's not very intuitive to use Right-Click, and it's certainly not compatible with Accessibility features.
  2. Why would you want such an option? It doesn't exist in Windows Explorer, for example.

@vnbaaij
Copy link
Collaborator Author

vnbaaij commented Apr 11, 2024

We can have a method to "remove" the sort order, but :

  1. It's not very intuitive to use Right-Click, and it's certainly not compatible with Accessibility features.

I'll look into the a11y piece. Good point.

  1. Why would you want such an option? It doesn't exist in Windows Explorer, for example.

It is fairly common to have a way to "unsort" a column in a DataGrid (MudBlazor, Radzen and DevExpress have it too)

@vnbaaij vnbaaij merged commit 222b024 into dev Apr 11, 2024
4 checks passed
@vnbaaij vnbaaij deleted the users/vnbaaij/datagrid-remove-sort branch April 11, 2024 12:09
@tommyvct
Copy link

  1. It's not very intuitive to use Right-Click, and it's certainly not compatible with Accessibility features.

How about click for the 3rd time to remove the sort?

@vnbaaij
Copy link
Collaborator Author

vnbaaij commented Apr 12, 2024

How about click for the 3rd time to remove the sort?

No. that is not an option currently. Internally the button just looks at a boolean sortByAscending variable. Would need a lot more additional coding.

@tommyvct
Copy link

I see, that could introduce a lot of work and chaos...

How about have another button, like the filter button to remove the sort?

@vnbaaij vnbaaij modified the milestones: v4.6.2, v4.7.0 Apr 22, 2024
vnbaaij added a commit that referenced this pull request Apr 29, 2024
* Add remove sort for datagrid

* Undo remove sort method returning bool

* A11y fixes: add keydown handler to remove column sort

* Update WhatsNew
Update DataGrid a11y docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement A non-feature-adding improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants