Skip to content

Commit

Permalink
[docs] Warn about the valueGetter and valueFormatter signature ch…
Browse files Browse the repository at this point in the history
…ange (#14613)
  • Loading branch information
cherniavskii authored Sep 16, 2024
1 parent 2777772 commit 4fe6da6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
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);
});
});
});

0 comments on commit 4fe6da6

Please sign in to comment.