You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the example on the components page for Grid Filtering - https://vaadin.com/docs/latest/components/grid#filtering. If you have the input box in the header the width of that input box seems to be taken into account when you have your columns set to autosize. For example, if you have a very thin column and you size it using .setAutoWidth(true).setFlexGrow(0) it will be wider than necessary due to the input box width.
Expected outcome
I would expect the column width to be determined by the content width of the cell content.
I was able to put together a hacky fix for it, but it doesn't seem like it should be necessary and seems like the wrong way to do it. Basically, this code sets the input box to 1px until after the column width gets recalculated. Then it sets the width of the input box back to 100%.
Dear @thejoker101, the current logic is working as intended.
This issue is considered to be a documentation issue and the example could be added on how to shrink the header content.
yuriy-fix
changed the title
Grid Filtering Example Doesn't Work Well With Autosized Columns
Document how to shrink header content in autosized columns
Dec 19, 2024
Description
Using the example on the components page for Grid Filtering - https://vaadin.com/docs/latest/components/grid#filtering. If you have the input box in the header the width of that input box seems to be taken into account when you have your columns set to autosize. For example, if you have a very thin column and you size it using
.setAutoWidth(true).setFlexGrow(0)
it will be wider than necessary due to the input box width.Expected outcome
I would expect the column width to be determined by the content width of the cell content.
Minimal reproducible example
The example on https://vaadin.com/docs/latest/components/grid#filtering will work as a base, just make one have smaller cell content and set the columns to auto size.
Steps to reproduce
See above.
I was able to put together a hacky fix for it, but it doesn't seem like it should be necessary and seems like the wrong way to do it. Basically, this code sets the input box to 1px until after the column width gets recalculated. Then it sets the width of the input box back to 100%.
In a wrapper class around Grid:
Environment
Vaadin version(s): Latest
OS:
Browsers
Chrome
The text was updated successfully, but these errors were encountered: