gregnb / mui-datatables

Datatables for React using Material-UI
MIT License
2.71k stars 934 forks source link

100% browser vertical real estate #1814

Open vavanv opened 3 years ago

vavanv commented 3 years ago

"react": "^17.0.2", "@mui/material": "^5.0.6", "mui-datatables": "^4.0.0",

is it possible to have fixed title and grid resizable vertically to allocate 100% browser real estate ?

tableBodyHeight allows 100% but the fixed header does not work

vavanv commented 3 years ago

I've figured it out


  const calcTableHeight = () => window.innerHeight - 390 + 'px';
  const [tableHeight, setTableHeight] = React.useState(calcTableHeight);
  React.useEffect(() => {
    window.onresize = () => setTableHeight(calcTableHeight);
  }, []);

use in options

options={{
...
  fixedHeader: true,
  tableBodyHeight: tableHeight,
...
}}