mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
3.92k stars 1.2k forks source link

[question] Setting background on even rows #13738

Closed atsoy closed 1 day ago

atsoy commented 4 days ago

The problem in depth

I've noticed some strange behaviour, by ctustomizing the row's background (e.g for even rows). While scrolling down, rows switch colors, and then switch back (to what actually should be after custom sx was applied). Is it a bug or may be you have a better approach to achieve desired styles without side effects?

Demo: https://codesandbox.io/p/sandbox/solitary-bird-fcgvkd Steps to reproduce:

Desired behaviour:

Your environment

`npx @mui/envinfo` ``` System: OS: macOS 14.5 Binaries: Node: 20.11.0 - /node/v20.11.0/bin/node npm: 10.2.4 - /node/v20.11.0/bin/npm Browsers: Chrome: 126.0.6478.127 Edge: 114.0.1823.58 Safari: 17.5 npmPackages: @emotion/react: ~11.11.1 => 11.11.4 @emotion/styled: ~11.11.0 => 11.11.5 @mui/base: 5.0.0-dev.20240529-082515-213b5e33ab @mui/core-downloads-tracker: 5.15.19 @mui/material: 5.15.19 => 5.15.19 @mui/private-theming: 5.15.14 @mui/styled-engine: 5.15.14 @mui/system: 5.15.15 => 5.15.15 @mui/types: 7.2.14 @mui/utils: 5.15.14 => 5.15.14 @mui/x-data-grid: 7.6.2 => 7.6.2 @mui/x-data-grid-pro: 7.6.2 => 7.6.2 @mui/x-date-pickers: 7.6.2 => 7.6.2 @mui/x-date-pickers-pro: 7.6.2 => 7.6.2 @mui/x-license: 7.6.1 @types/react: 18.2.24 => 18.2.24 react: ~18.2.0 => 18.2.0 react-dom: ~18.2.0 => 18.2.0 styled-components: 6.1.8 typescript: 5.4.3 => 5.4.3 ```

Search keywords: css, styling Order ID: 62555

romgrk commented 4 days ago

Your sandbox is not public, but you might want to read this first: https://mui.com/x/react-data-grid/style/#striped-rows Let us know if there's something missing from the docs.

atsoy commented 1 day ago

Hi @romgrk , thank you for the hint. I actually forgot about this, we use it already for setting other classes, but of course we can also extend the check :) I'll close this issue

github-actions[bot] commented 1 day ago

:warning: 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.

@atsoy: 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.