GridPro.addEditColumn(...), how to make it use autoWidth just like non editable columns

Vaadin 24.x.x

I am trying to make a grid with some editable columns where the content of these editable columns varies quite a lot.
The issue I am facing is that editable columns do not scale as normal columns do with setAutoWidth(true).
I would expect a horizontal scroller popping up if the content does not fit, but with editable columns this does not happen and some are not even visible anymore.

How can I make these editable columns also autoscale like non editable columns?

Do you have a code example of how you’re creating the GridPro and the columns?

You are probably looking for something like how the email filed has been styled here: How do I enable conditional editing of the cells in GridPro and style compact editor field. - Vaadin Cookbook

You need two things, make email field 100% wide, and import GridPro editor styles and apply them to email field.

Yes surely!
this is how I create the grid with the editor fields.
I have just added 2 here but I normally have around 20 columns so a scrollbar comes up.

GridPro<MyObject> grid = new GridPro<>();
grid.setWidthFull();
grid.setAllRowsVisible(true);

# This does not scale as expected
grid.addEditColumn(MyObject::method)
    .text((objectToUpdate, newValue) -> dostuff())
    .setHeader("header")
    .setAutoWidth(true)
    .setFrozen(true);

# This scales as expected
grid.addColumn(MyObject::method2).header("header2").setAutoWidth(true);

If it doesn’t work right even with the standard (non-custom) editors, I’d say it sounds like a bug, or at least missing functionality. In that case, I’d recommend creating an issue in Issues · vaadin/flow-components · GitHub

Just noting that fields do have some minimum width. So that may be the reason. If it is that, what you see is working as expected.

Had to try this out and you are correct. Does not seem to work.

I’ll file a bug/feature ticket.

1 Like

Thank you for the help, will keep an eye out for the fix!