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

Add support for dense table

Open mohemos opened this issue 5 years ago • 7 comments

Just as material-ui dense table and bootstrap small table, Kindly support dense option to make tables more compact by cutting cell padding.

mohemos avatar Jun 23 '19 01:06 mohemos

This looks like it could be done via a setTableProps option, similar to https://github.com/gregnb/mui-datatables/issues/871, if I have time, I'll see about putting a PR together tomorrow.

patorjk avatar Aug 30 '19 04:08 patorjk

Just in case anyone else needs this, the example https://github.com/gregnb/mui-datatables/issues/871 mentioned above uses

      ...
      options: {
        setTableProps: () => {
          return {
            // material ui v4 only
            size: 'small',
          };
        },
       ...

ltalirz avatar Aug 24 '21 12:08 ltalirz

any updates on this? MUI 5 is out so I take that this isn't compatible anymore?

alexkrytsky avatar Feb 11 '22 01:02 alexkrytsky

any updates on this? MUI 5 is out so I take that this isn't compatible anymore?

It just works, all you need is trying ;)

eplatek-safyr avatar Feb 23 '22 13:02 eplatek-safyr

Just in case anyone else needs this, the example #871 mentioned above uses

      ...
      options: {
        setTableProps: () => {
          return {
            // material ui v4 only
            size: 'small',
          };
        },
       ...

saved my day, thanks

emileWhispa avatar May 16 '22 09:05 emileWhispa

Thanks @ltalirz. I've updated your fix for MUI v5:

      ...
      options: {
        setTableProps: () => {
          return {
            // material ui v5 only
            size: 'small',
          };
        },
       ...

alxndrsn avatar Aug 02 '22 07:08 alxndrsn

hey @alxndrsn , I am trying to use this for setting my table density on click of a free-action. I am just calling the options.setTableProps() method in the click handler of the free action and I added the function to my options object as shown above. But no luck. I have also tried just setting the size option to "small" and I am not seeing a change in my table rows padding. Are there css styles that may conflict with this option setting?

Hubbsy avatar Aug 02 '22 19:08 Hubbsy