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] Explain how to use valueGetter to transform type #3003

Merged
merged 6 commits into from
Nov 2, 2021

Conversation

alexfauquette
Copy link
Member

@alexfauquette alexfauquette commented Oct 27, 2021

Solves #1313

add a paragraph in "column types" section to explain that column of type "dateTime" should not be stored with a string value.

I added subsections to separate clearly the two topics:

  • the additional properties
  • data type

preview: https://deploy-preview-3003--material-ui-x.netlify.app/components/data-grid/columns/#column-types

@alexfauquette alexfauquette self-assigned this Oct 27, 2021
@oliviertassinari oliviertassinari changed the title [Doc] explain how to use valueGetter to transform type [docs] Explain how to use valueGetter to transform type Oct 28, 2021
@oliviertassinari oliviertassinari added docs Improvements or additions to the documentation component: data grid This is the name of the generic UI component, not the React module! labels Oct 28, 2021
@alexfauquette
Copy link
Member Author

It seems that defining sortComparator is not mandatory when using valueGetter

because applySorting uses getSortCellParams to get the parameters to apply the sorting function. And in these params, the value is given by valueGetter if defined:

/~https://github.com/mui-org/material-ui-x/blob/2aa2bcf322cd6ea886b1c52ba1d7b6ac2cc3a0d9/packages/grid/_modules_/grid/hooks/features/rows/useGridParamsApi.ts#L132L155

I did some archeology, the comment has been added in the doc by this PR. And at that time, the applySorting was different.

Does someone see another reason why the documentation should ask dev to provide a sortComparator when using valueGetter here? Otherwise, I will remove it @mui-org/x

alexfauquette and others added 2 commits November 1, 2021 15:23
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
@alexfauquette alexfauquette merged commit 97d5880 into mui:next Nov 2, 2021
@alexfauquette alexfauquette deleted the explain-column-type branch November 2, 2021 08:17
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! docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants