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

[docs] Fix country column sorting not working #3740

Merged
merged 9 commits into from Jan 31, 2022

Conversation

cherniavskii
Copy link
Member

@cherniavskii cherniavskii commented Jan 25, 2022

Fixes #3681

It exposed few things that I'm going extract to a separate issue:

  • improve sortComparator typing. [DataGrid] Improve sortComparator typing #3741
    Currently for TypeScript to stop complaining users have to use type assertion, e.g.:

    sortComparator: (v1, v2) =>
      (v1 as { label: string }).label.localeCompare(
        (v2 as { label: string }).label,
      ),
  • Add runtime warning if valueSetter is missing.
    According to docs:

    If you are using a valueGetter to extract the value from a nested object, then a valueSetter also needs to be provided.
    https://mui.com/components/data-grid/editing/#saving-nested-structures

    It looks like valueSetter is required when column is editable and has valueGetter.
    If so, we should add a console warning in this case.

sort by label, so that options in filter select are sorted alphabetically
@@ -325,4 +325,4 @@ export const COUNTRY_ISO_OPTIONS = [
{ value: 'ZA', code: 'ZA', label: 'South Africa', phone: '27' },
{ value: 'ZM', code: 'ZM', label: 'Zambia', phone: '260' },
{ value: 'ZW', code: 'ZW', label: 'Zimbabwe', phone: '263' },
];
].sort((v1, v2) => v1.label.localeCompare(v2.label));
Copy link
Member Author

Choose a reason for hiding this comment

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

To make sure countries are sorted alphabetically in filter select

@mui-bot
Copy link

mui-bot commented Jan 25, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 1,111.6 1,839.1 1,136.6 1,378.1 317.186
Sort 100k rows ms 670 1,198.3 1,198.3 948.56 194.592
Select 100k rows ms 142.3 275.6 205.2 205.06 43.35
Deselect 100k rows ms 100.9 262.7 197.8 177.68 61.694

Generated by 🚫 dangerJS against b799c08

@oliviertassinari oliviertassinari added the component: data grid This is the name of the generic UI component, not the React module! label Jan 25, 2022
@cherniavskii cherniavskii merged commit f6697ee into mui:master Jan 31, 2022
@cherniavskii cherniavskii deleted the docs-country-sorting-demo branch January 31, 2022 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Docs] Country sorting doesn't work on demo page
4 participants