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

[data grid] valueGetter row is always never #13564

Closed
atlanteh opened this issue Jun 20, 2024 · 3 comments
Closed

[data grid] valueGetter row is always never #13564

atlanteh opened this issue Jun 20, 2024 · 3 comments
Labels
component: data grid This is the name of the generic UI component, not the React module! support: commercial Support request from paid users support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@atlanteh
Copy link

atlanteh commented Jun 20, 2024

Steps to reproduce

Link to live example: (required)
https://stackblitz.com/edit/github-yxclaf?file=src%2Findex.tsx,src%2Fdemo.tsx

Steps:

  1. Create a simple DataGridPro with a column that has valueGetter
function MyGrid() {
    return (
        <DataGridPro<MyRow>
            columns={[
                { field: 'workspaceId', headerName: 'Workspace', minWidth: 100, flex: 1, type: 'string', valueGetter: ({row}) => row.workspace.name},
            ]}
        />
    )
}

Current behavior

The row is always never and can't use it without casting

Expected behavior

row has the supplied type

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: valueGetter, never
Order ID: 56081

@atlanteh atlanteh added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 20, 2024
@atlanteh
Copy link
Author

Nevermind. Didn't read the migration all the way through. I see the valueGetter api has changed

Copy link

⚠️ This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@atlanteh: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

@github-actions github-actions bot removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 20, 2024
@michelengelen
Copy link
Member

michelengelen commented Jun 20, 2024

In v7 we changed the function signature.
In your case it would look like this:

valueGetter: (_, row) => row.workspace.name,

EDIT: I have been a few ticks too late to answer! Glad you found it! :D

@michelengelen michelengelen changed the title valueGetter row is always never [data grid] valueGetter row is always never Jun 20, 2024
@michelengelen michelengelen added component: data grid This is the name of the generic UI component, not the React module! support: commercial Support request from paid users support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/ labels Jun 20, 2024
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! support: commercial Support request from paid users support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/
Projects
None yet
Development

No branches or pull requests

2 participants