Skip to content

Commit

Permalink
fix outdated demo
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed May 27, 2021
1 parent fd5fb67 commit 789e3dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/src/pages/components/data-grid/columns/columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ To achieve that, set the `valueGetter` attribute of `GridColDef` as in the examp
**Note**: You need to set a `sortComparator` for the column sorting to work when setting the `valueGetter` attribute.

```tsx
function getFullName(params: ValueGetterParams) {
return `${params.getValue('firstName') || ''} ${
params.getValue('lastName') || ''
function getFullName(params) {
return `${params.getValue(params.id, 'firstName') || ''} ${
params.getValue(params.id, 'lastName') || ''
}`;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ const columns: GridColDef[] = [
description: 'This column has a value getter and is not sortable.',
sortable: false,
width: 160,
valueGetter: ({ row }) => `${row.firstName || ""} ${row.lastName || ""}`
valueGetter: (params: GridValueGetterParams) =>
`${params.getValue(params.id, 'firstName') || ''} ${
params.getValue(params.id, 'lastName') || ''
}`,
},
];

Expand Down

0 comments on commit 789e3dc

Please sign in to comment.