Material-table: column width not working on 1.69.2

Created on 4 Dec 2020  路  3Comments  路  Source: mbrn/material-table

column width not working on 1.69.2

const columns = [
  {
    title: 'Name',
    field: 'name'
  },
  {
    title: 'Description',
    field: 'description',
  },
  {
    title: 'Version',
    field: 'version',
    width: 80
  }]

...

<MaterialTable
            columns={columns}
            data={data}
            options={{
              filtering: true,
              showTitle: false,
              search: false,
              toolbar: false,
              draggable: false
            }}
        />

the table cell for version is not fixed to 80px but share the same width of the other columns.

It is probably a bug of the new code change in https://github.com/mbrn/material-table/blob/b7474ca0f5497f04ff3a3d50e709d86de7c639b0/src/utils/data-manager.js#L64.

    const undefinedWidthColumns = columns.filter((c) =>
      c.width === undefined && c.columnDef
        ? c.columnDef.tableData.width === undefined
        : true && !c.hidden
    );

And BTW, IMO the new code is hard to read, please refactor to be more readable and maintainable.

bug

All 3 comments

I can confirm that. My table clomuns are now stretching like crazy.

@proutek rollback to 1.69.0 works for me

I think its related to / duplicated by https://github.com/mbrn/material-table/issues/2643

Was this page helpful?
0 / 5 - 0 ratings