I Need to show First column of table is sticky , I am able to do for first column of table body but not for header , when I apply CSS for Table body automatically header sticky is not working.
import { createTheme, ThemeProvider } from '@mui/material/styles';
const getMuiTheme = () =>
createTheme({
components: {
MUIDataTableToolbar: {
styleOverrides: {
root: {
minHeight: '50px',
display: 'flex',
},
actions: {
display: 'flex',
flex: 'inherit',
},
},
},
MUIDataTableHeadCell: {
styleOverrides: {
root: {
'&:first-child': {
opacity: 1, // Set the opacity value you desire (0.0 to 1.0) for the first column cells
position: 'sticky',
left: 0,
zIndex: 1,
backgroundColor: 'white', // Set the background color as needed
},
// borderBottom: 'none !important',
borderTop: '1px solid #d9d9d9',
fontSize: '14px !important',
fontFamily: 'helvetica !important',
fontWeight: 'bold !important',
padding: '10px 16px 10px 16px',
// borderRight: 'none',
},
toolButton: {
fontSize: '14px !important',
fontFamily: 'helvetica !important',
fontWeight: 'bold !important',
},
},
},
MuiTableCell: {
styleOverrides: {
root: {
'&:first-child': {
opacity: 1, // Set the opacity value you desire (0.0 to 1.0) for the first column cells
position: 'sticky',
left: 0,
zIndex: 1,
backgroundColor: 'white', // Set the background color as needed
},
color: "#000000", // This sets the text color for all cells
},
},
},
},
});
<TableContainer className={classes.container}>
<ThemeProvider theme={getMuiTheme()}>
<MUIDataTable
// title='Search Results'
// components={{
// TableFooter: CustomFilterList,
// }}
data={data}
columns={headers}
options={options}
// components={components}
/>
</ThemeProvider>
</TableContainer>
I want to see both table header first column and body first column should be sticky , when i scroll left it should be sticky and opacity should apply