Skip to content

[data grid] Stable sorting of DataGrid columns #10866

Open
@laurisvan

Description

@laurisvan

Summary 💡

DataGrid has interesting keyboard modifiers for primary and secondary sorting. However, these are difficult for anybody but heavy users to learn.

Instead, why not use stable sorting when ordering DataGrid contents? For example, see the examples at https://mui.com/x/react-data-grid/sorting/ - when first sorting by "Created on", then "Rating", one would expect to get 5-star rated items on the top, secondarily ordered by "Created on". Instead, the "Created on" seems to get in a seemingly arbitrary order.

This has been a standard behavior for e.g. OS/X and Windows file browsers, Excel etc, so a lot of users have learnt to make use of it.

This probably would also help when inserting items in-between etc, so that the order would be retained.

I am a bit unsure on why the order is not stable, as e.g. JavaScript Array.sort() has been guaranted to be stable as of ECMAScript 2019. What might be the reason DataGrid would not retain its order?

Examples 🌈

No response

Motivation 🔦

Providing stable sorting would create a compelling and widely used alternative to the difficult primary and secondary sorting column keyboard modifiers.

Search keywords: datagrid stable sort
Order ID: 69243

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature: SortingRelated to the data grid Sorting featureplan: ProImpact at least one Pro userscope: data gridChanges or issues related to the data grid productstatus: waiting for upvotesThis request is open for community feedback and needs more interest to be considered.type: new featureIntroduces a new piece of functionality or capability.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions