mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.73k stars 32.24k forks source link

[Table] Support fixed footer #23833

Closed michael-land closed 3 years ago

michael-land commented 3 years ago

Summary 💡

I'm always frustrated when add styles or create classes just for stickyFooter.

<TableFooter>
   <TableRow>
      <TableCell style={{ backgroundColor: '#fafafa', position: 'sticky', bottom: 0 }} />
      ...
    </TableRow>
</TableFooter>

It would be nice MUI support stickyFooter that fixed column footers natively.

<Table stickyHeader stickyFooter />

Examples 🌈

image

oliviertassinari commented 3 years ago

@xiaoyu-tamu See the demo at https://next.material-ui.com/components/tables/#fixed-header, the footer is already fixed. The difference between the footer and the header is that the header horizontal scroll positions need to be sync with the cells, it's not the case for the footer.

michael-land commented 3 years ago

@oliviertassinari

Right, the fixed-header example has fixed footer ( i would say it's a fixed toolbar/paginations ).

What I refer to is make tfoot > td fixed inside <table />, it should sync horizontal scroll with cells.

I think it's useful when ppl want to duplicate column names in bottom or display aggregate(sum,avg,..etc) value below each cell for long content table.

for example:

Screen Recording 2020-12-04 at 9 54 51 AM