mui-datatables icon indicating copy to clipboard operation
mui-datatables copied to clipboard

Set MUIDataTable theme header position to 'sticky'

Open perazzo opened this issue 2 years ago • 0 comments

I'm trying to set the position of my thead to be 'sticky' in MUIDataTable .

I have a getMuiTheme method:

export const getMuiTheme = () => createMuiTheme({
  overrides: {
      MuiTableCell: {
          head: {
              backgroundColor: "#c1e1ec !important",
              position: 'sticky',
          }
      },
  }
});

And I set this theme in my MuiThemeProvider:

<MuiThemeProvider theme={getMuiTheme()}>                                                    
   <MUIDataTable
      title={renderTitle()}
      data={showUnits()}
      columns={columns}
      options={options}
   />
</MuiThemeProvider>

The backgroundColor works, but my position do not work. If I manually change the thead position using the browser console, it works.

perazzo avatar Dec 26 '22 18:12 perazzo