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] The cell selection color is not being applied #13581

Closed
mahammahmood opened this issue Jun 21, 2024 · 2 comments
Closed

[data grid] The cell selection color is not being applied #13581

mahammahmood opened this issue Jun 21, 2024 · 2 comments
Labels
component: data grid This is the name of the generic UI component, not the React module! customization: css Design CSS customizability feature: Cell Selection Related to the cell selection feature status: waiting for author Issue with insufficient information support: commercial Support request from paid users support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@mahammahmood
Copy link

mahammahmood commented Jun 21, 2024

The problem in depth

When I select a cell with conditional formatting applied to the date, the cell selection color is not being applied to it.

In the screenshot, when I select the cells, the cells without color have the cell selection color applied, while the colored cells do not.
Screenshot 2024-06-21 181103
Screenshot 2024-06-21 181145

Here is a live demo of my problem.
Demo

Your environment

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

Search keywords: Data, Grid, Premium, cell, selection
Order ID: 91010

@mahammahmood mahammahmood added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Jun 21, 2024
@michelengelen michelengelen added component: data grid This is the name of the generic UI component, not the React module! customization: css Design CSS customizability feature: Cell Selection Related to the cell selection feature support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/ labels Jun 21, 2024
@michelengelen michelengelen changed the title The cell selection color is not being applied [data grid] The cell selection color is not being applied Jun 21, 2024
@michelengelen
Copy link
Member

Hey @mahammahmood ... this is because the renderCell function you use defines a custom background color for your cell:

renderCell: (params: any) => (
  <>
    <Box
      px="10px"
      sx={{
        backgroundColor:
          params.row.RAD_Complete_F < params.row.RAD_Complete_A
            ? "#FFE7E5"
            : "#CAFFE4",
        height: "100%",
        width: "100%",
      }}
    >
      <Stack
        justifyContent="center"
        sx={{
          height: "100%",
          width: "100%",
          color:
            params.row.RAD_Complete_F < params.row.RAD_Complete_A
              ? "#FF2D1E"
              : "#139B57",
        }}
      >
        {formatCustomCompleteDate(params.value, storedDateFormat)}
      </Stack>
    </Box>
  </>
),

In your screenshot you can see that the background of your cell is actually using the selection background color, but the red content is overlaying it, so it is not shown

@michelengelen michelengelen added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jun 21, 2024
Copy link

The issue has been inactive for 7 days and has been automatically closed.

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! customization: css Design CSS customizability feature: Cell Selection Related to the cell selection feature status: waiting for author Issue with insufficient information support: commercial Support request from paid users support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/
Projects
None yet
Development

No branches or pull requests

2 participants