-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataGrid: Cannot read properties of undefined (reading 'mode') #7505
Comments
in case it helps anyone else, I needed to wrap the app in a and that solved the issue |
Are you passing in a Theme to the provider? |
Yes i am |
this is what worked for me... if I remember right, I had to add the const MuiTheme = createTheme({
palette: {
mode: "dark",
},
components: {
MuiDataGrid: {
styleOverrides: {
root: {
border: 1,
borderColor: colors.primaryGrayMid,
borderStyle: "solid",
borderRadius: 10,
boxShadow: "0px 0px 10px rgba(0, 0, 0, 0.25)",
backgroundColor: colors.primaryGrayDark,
color: "#C1C2C5",
padding: 10,
},
},
},
},
});
<ThemeProvider theme={MuiTheme}>
{...}
</ThemeProvider>
|
Does someone know what is workaround for I'm getting I tried with MuiDataGrid and vars but none of it works. export function createTheme(primaryColor: PrimaryColor): Theme {
return extendTheme({
components: {
MuiDataGrid: {
styleOverrides: {
root: {
border: 1,
borderStyle: 'solid',
borderRadius: 10,
boxShadow: '0px 0px 10px rgba(0, 0, 0, 0.25)',
color: '#C1C2C5',
padding: 10,
},
TableCell: {
// Add your TableCell styles here
backgroundColor: '#fff', // replace '#colorValue' with the actual color value
border: '#fff', // replace '#borderColor' with the actual border color value
// other TableCell styles...
},
},
},
vars: {
palette: {
TableCell: {
border: '#fff', // replace '#borderColor' with the actual border color value
// ...existing vars.palette.TableCell properties
},
// ...existing vars properties
},
},
} |
Has there been progress on this? I'm facing the same issue. |
Yes. I created MUI wrapper inside joy-ui since there was Theme collision. import * as React from 'react';
import {
Experimental_CssVarsProvider as CssVarsProvider,
experimental_extendTheme as extendTheme,
} from '@mui/material/styles';
const baseTheme = extendTheme();
const darkTheme = extendTheme({
colorSchemes: {
light: baseTheme.colorSchemes.dark,
dark: baseTheme.colorSchemes.dark,
// dark: {
// palette: {
// background: {
// default: '#2e353d',
// },
// text: {
// primary: '#e9e9e9',
// secondary: '#cacaca',
// },
// },
// },
},
});
export interface DataGridThemeProps {
children: React.ReactNode;
}
export function DataGridTheme({
children,
}: DataGridThemeProps): React.JSX.Element {
return (
<CssVarsProvider
defaultMode="dark"
disableNestedContext
theme={darkTheme}
>
{children}
</CssVarsProvider>
);
} <DataGridTheme>
<AdvancedTable (DataGrid)
columns={columns}
rows={probeDetails?.attack_results || []}
/>
</DataGridTheme> |
Wrapping the MUI datagrid in a MUI CssVarsProvider with a MUI extendTheme created theme fixed it. Thanks! |
Duplicates
Latest version
Steps to reproduce 馃暪
Current behavior 馃槸
Expected behavior 馃
Render a basic DataGrid component
Context 馃敠
I'm trying to render a basic DataGrid table using the basic demo. I have installed all dependencies but getting a typeerror.
Your environment 馃寧
This is a next.js project using the T3 stack. I also have Mantine installed which has a context wrapper around my app root.
System: OS: macOS 13.2 Binaries: Node: 16.14.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.19.2 - /usr/local/bin/npm Browsers: Chrome: 108.0.5359.124 Edge: Not Found Firefox: 88.0.1 Safari: 16.2 npmPackages: @emotion/react: ^11.10.5 => 11.10.5 @emotion/styled: ^11.10.5 => 11.10.5 @mui/base: 5.0.0-alpha.113 @mui/core-downloads-tracker: 5.11.4 @mui/icons-material: ^5.11.0 => 5.11.0 @mui/material: ^5.11.4 => 5.11.4 @mui/private-theming: 5.11.2 @mui/styled-engine: 5.11.0 @mui/system: 5.11.4 @mui/types: 7.2.3 @mui/utils: 5.11.2 @mui/x-data-grid: ^5.17.18 => 5.17.18 @types/react: ^18.0.14 => 18.0.26 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 typescript: ^4.8.4 => 4.9.4npx @mui/envinfo
Order ID 馃挸 (optional)
No response
The text was updated successfully, but these errors were encountered: