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] Warn about the valueGetter and valueFormatter signature change #14613

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/data/data-grid/column-definition/column-definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ But for some columns, it can be useful to manually get and format the value to r

### Value getter

:::warning
Note that the signature of `valueGetter` has changed in v7 – see the [migration guide](https://mui.com/x/migration/migration-data-grid-v6/) for details.

If you're using v6, please use the [v6 documentation](https://v6.mui.com/x/react-data-grid/column-definition/#value-getter).
:::

Sometimes a column might not have a desired value.
You can use the `valueGetter` attribute of `GridColDef` to:

Expand Down Expand Up @@ -102,6 +108,12 @@ The value passed to the `groupingValueGetter` is the raw row value (`row[field]`

### Value formatter

:::warning
Note that the signature of `valueFormatter` has changed in v7 – see the [migration guide](https://mui.com/x/migration/migration-data-grid-v6/) for details.

If you're using v6, please use the [v6 documentation](https://v6.mui.com/x/react-data-grid/column-definition/#value-formatter).
:::

The value formatter allows you to convert the value before displaying it.
Common use cases include converting a JavaScript `Date` object to a date string or a `Number` into a formatted number (for example "1,000.50").

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,14 @@ describe('<DataGridPro /> - Infnite loader', () => {
}
const { container } = render(<TestCase rows={baseRows} pinnedRows={basePinnedRows} />);
const virtualScroller = container.querySelector('.MuiDataGrid-virtualScroller')!;
await sleep(1);
// after initial render and a scroll event that did not reach the bottom of the grid
// the `onRowsScrollEnd` should not be called
expect(handleRowsScrollEnd.callCount).to.equal(0);
// arbitrary number to make sure that the bottom of the grid window is reached.
virtualScroller.scrollTop = 12345;
virtualScroller.dispatchEvent(new Event('scroll'));
await sleep(1);
expect(handleRowsScrollEnd.callCount).to.equal(1);
await waitFor(() => {
expect(handleRowsScrollEnd.callCount).to.equal(1);
});
});
});