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

Adding custom components to column header span after sort

Open TBenton-eb opened this issue 2 years ago • 1 comments

I am looking for a way to add a custom component after the sort icon outside of the button. I think it would be beneficial to add a prop that would allow for injection of such components.

image

This is a decent amount of dead space which could be used for column specific actions like having a button for opening a modal for search or filter.

It would be easier then having to build a whole new header using what is already available.

TBenton-eb avatar Jan 18 '23 23:01 TBenton-eb

Although I was not able to insert a custom component there, after some time of trial and error, I've found out that it's possible to apply the style justifyContent: 'center' to distribute the excessive space to the cell ends. I did it as so,

const getMuiTheme = () =>
  createTheme({
    components: {
      MUIDataTableHeadCell: {
        styleOverrides: {
          contentWrapper: {
            justifyContent: 'center',
          },
        },
      },
    },
  });

juanbomfim22 avatar Feb 17 '23 19:02 juanbomfim22