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

Column Width not being respected

Open brunomptorres opened this issue 5 years ago • 16 comments

After the newly released 1.6.2, the column widths stopped being respected. Until now we just set the width parameter in the columns configuration and that made the columns have that width, but since the update, the column's widths are automatically calculated.

Did this configuration changed or is this a bug that was introduced? If this was intentional how should we lock the width of the columns from now on?

Example of how we've been doing so far:

const columns = [
        {
            title: "Status",
            sorting: false,
            render: ({ status }) => status,
        },
        {
            render: (rowData) => getActionButtons(rowData),
            width: 150,
        },
        {
            title: "Actions",
            field: "more",
            sorting: false,
            headerStyle: { textAlign: "center" },
            cellStyle: { textAlign: "right" },
            render: (rowData) => getButtons(rowData),
            width: 120,
        },
        {
            render: ({ uuid, status }) => getGoTo(uuid, status),
            width: 40,
        },
];

brunomptorres avatar Nov 20 '20 16:11 brunomptorres

Sounds like this may fix that? https://github.com/mbrn/material-table/pull/2511

zeckdude avatar Nov 22 '20 22:11 zeckdude

@zeckdude if the width parameter starts to be taken into account again, it should solve it.

brunomptorres avatar Nov 23 '20 11:11 brunomptorres

Sounds like this may fix that? #2511

That will only allow us to apply width by using headerStyle / cellStyle together. Width is still overwritten with the CommonValues.reducePercentsInCalc function...

avionbg avatar Nov 23 '20 19:11 avionbg

Ah ok. I reverted to 1.64.0 for now and that solved it

zeckdude avatar Nov 23 '20 20:11 zeckdude

We reverted to 1.69.1 and locked it there for now, as it works as we expect.

brunomptorres avatar Nov 24 '20 11:11 brunomptorres

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Feb 22 '21 12:02 stale[bot]

Version 1.69.1 works fine for me to set the width of a column.

In version 1.69.2, the width seems to be ignored again.

MglMX avatar Feb 22 '21 13:02 MglMX

1.69.3 - I don't see any regularity it the calculation of columns width.

        columns={[
          { title: t('ID'), field: 'id', type: 'numeric', width: 1 },
          { title: t('Name'), field: 'name', width: 1 },
          { title: t('Bitrate'), field: 'bitrate', type: 'numeric', width: 2 },
        ]}

Changing 1 to 100 and 2 to 200 doesn't make any difference.

makes each column to have width: calc(146.333px); style. I.e. - equal. So it's still buggy.

OnkelTem avatar Apr 26 '21 19:04 OnkelTem

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Jul 25 '21 19:07 stale[bot]

It would be nice if this issue can fixed. We are also locked on v1.69.1 due to this bug...

Lionqueen94 avatar Jul 26 '21 07:07 Lionqueen94

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Oct 24 '21 08:10 stale[bot]

Please fix this 🙏

Lionqueen94 avatar Oct 29 '21 09:10 Lionqueen94

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Jan 28 '22 03:01 stale[bot]

Bump, still not fixed

Lionqueen94 avatar Jan 28 '22 09:01 Lionqueen94

Still there in v2.0.3

arulprabhin avatar Apr 07 '22 14:04 arulprabhin

You can use 1.69.0 until they resolve this bug.

JayantkrSingh avatar Jun 16 '22 12:06 JayantkrSingh

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Sep 24 '22 10:09 stale[bot]