Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double clicking on resizer in a table header should auto-size the column #7398

Open
probert94 opened this issue May 10, 2024 · 0 comments
Open
Labels
enhancement New feature or request vaadin-grid

Comments

@probert94
Copy link

Describe your motivation

I would like to be able to auto-resize a resizable column by double-clicking on the resizer in the header.
This behavior is something users know for example from excel.
There was also a similar issue for Vaadin framework.

Describe the solution you'd like

A double click should basically auto-resize the column to the width it would get when setting auto-width to true and recalculating the column widths.

Describe alternatives you've considered

Currently, I create my own grid-connector which adds this functionality.
First of all I overwrite the method _columnTreeChanged of the grid to know when new columns are added. That way I can register the double click listeners for the new columns.
In the listener, I set autoWidth=true, call recalculateColumnWidths and then I set autoWidth to false again. This works mostly, because I don't really use autoWidth outside this functionality.
Last but not least, I dispatch a column-reisze event, so that also the server gets notified about the new column widths.
This works pretty good but of course a build-in solution would be much cleaner.

Additional context

Flow: 24.3.10
Vaadin: 24.3.11

@TatuLund TatuLund added the enhancement New feature or request label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vaadin-grid
Projects
None yet
Development

No branches or pull requests

3 participants