material-table icon indicating copy to clipboard operation
material-table copied to clipboard

rowStyle prop with MuiThemeProvider

Open Casperius88 opened this issue 7 years ago • 1 comments

I need to use rowStyle like this:

rowStyle: rowData => ({ 
   backgroundColor: this.state.selectedRow && this.state.selectedRow.tableData.id === rowData.tableData.id ? 'green' : 'white',
})

At the same time, I am using MuiThemeProvider to override some styles, like this:

const theme = createMuiTheme({
  overrides: {
    MuiTableCell: {
     root: {
        backgroundColor: 'white',
        padding: '5px',
      },
    },
    MuiTablePagination: {
      toolbar: {
        position: 'fixed',
        top: '817px'
      }
    },
  }

});


 <MuiThemeProvider theme={theme}>
   <MaterialTable>
      ...
   </MaterialTable>
</MuiThemeProvider>

rowStyle prop does not work when I use MuiThemeProvider. The question is, how can I get them both to work?

Any help would be much appreciated!

Casperius88 avatar Oct 16 '19 08:10 Casperius88

Can't you just remove the cell background override (backgroundColor: 'white') ? As it's prioritary over row style i think.

ricostone avatar Oct 17 '19 15:10 ricostone