web-components icon indicating copy to clipboard operation
web-components copied to clipboard

[grid] Make auto width default

Open rolfsmeds opened this issue 3 years ago • 4 comments

Describe your motivation

Auto-width (based on content) is the most common desired width for Grid columns, so it would make sense to have it as the default.

Describe the solution you'd like

Make auto-width the defaut column width in Grid (as well as GridPro and CRUD).

Additional context

This is of course a breaking change, but it will hardly be disruptive in any application, as a Grid with default widths probably doesn't make any assumptions about col widths, and cases where col width is important the default has probably already been changed. Thus minimal negative effect on existing apps.

rolfsmeds avatar Jul 21 '21 10:07 rolfsmeds

Note, this could be conflicting with https://github.com/vaadin/platform/issues/2046 in terms of affecting vaadin-grid performance.

web-padawan avatar Jul 21 '21 10:07 web-padawan

First step would be to test performance with auto-width on all cols, and see how much of a hit that causes.

If it's within acceptable levels, I think this would be a better out-of-the-box experience than the current 100px hardcoded default.

rolfsmeds avatar Aug 10 '21 09:08 rolfsmeds

It turns out that auto-width actually has a significant impact on performance that we are currently unable to mitigate. Decided not to do this for the time being.

rolfsmeds avatar Nov 30 '22 07:11 rolfsmeds

If we can't make it default, I would at least like to have a simple API for setting each column to automatic width. Something like:

<Grid autoWidth>
grid.setAutoWidth(true)

marcushellberg avatar Jan 18 '24 11:01 marcushellberg