Skip to content

[Bug]: DataGrid doesn't support default auto-fit and resize simultaneously #35923

@alton-browsing

Description

@alton-browsing

Component

DataGrid

Package version

9.72.3

React version

17.0.2

Environment

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
    Memory: 22.81 GB / 63.95 GB
  Browsers:
    Chrome: 146.0.7680.165
    Edge: Chromium (145.0.3800.70)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @fluentui/react-calendar-compat: 0.3.7 => 0.3.7
    @fluentui/react-charts: 9.1.6 => 9.1.6
    @fluentui/react-components: 9.72.3 => 9.72.3
    @fluentui/react-context-selector: 9.2.9 => 9.2.9
    @fluentui/react-datepicker-compat: 0.6.12 => 0.6.12
    @fluentui/react-icons: 2.0.312 => 2.0.312
    @fluentui/react-jsx-runtime: 9.3.0 => 9.3.0
    @fluentui/react-motion: 9.11.5 => 9.11.5
    @fluentui/react-motion-components-preview: 0.4.3 => 0.4.3
    @fluentui/react-shared-contexts: 9.25.2 => 9.25.2
    @fluentui/react-timepicker-compat: 0.4.13 => 0.4.13
    @fluentui/react-utilities: 9.24.1 => 9.24.1
    @types/react: 17.0.83 => 17.0.83
    @types/react-dom: 17.0.25 => 17.0.25
    react: 17.0.2 => 17.0.2
    react-dom: 17.0.2 => 17.0.2

Current Behavior

Column sizes are only default autofitted when resize is disabled.

Expected Behavior

I expected the columns to be auto-fitted by default but while still supporting resize. Is there some design limitation as for why the DataGrid was made this way?

Reproduction

https://stackblitz.com/edit/rqhrgmkq?file=src%2Fexample.tsx

Steps to reproduce

Just load the code, should be able to see its auto fitted initially but if you add resizeableColumns as a prop then it not equally spaced on load.

Are you reporting an Accessibility issue?

None

Suggested severity

Urgent - No workaround and Products/sites are affected

Products/sites affected

No response

Are you willing to submit a PR to fix?

no

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions