-
Notifications
You must be signed in to change notification settings - Fork 83
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
Apply a default min-height for Grid to avoid zero-height situations #4584
Comments
On second thought, I think the following min-height behavior would make more sense: headers + body-row + footers where
This is significantly more complicated to implement, but seeing as how clipped header and footer rows cannot be made visible through scrolling, it would make sense for them to always be included in the min-height. |
In order to make it possible to override the default min-height (by applying an inline style to
|
Did some prototyping in this branch The prototype applies the vaadin-grid {
min-height: 0;
} It uses constructable stylesheets for the purpose to avoid adding a confusing inline style such as |
Right, it should of course be possible to override it, so a style on the root applied as constructable makes sense. How come the empty body row is taller than an actual body row? |
When there's no actual data for the rows yet, there's nothing to measure and it falls back to some default row height (I used 40px in the proto). Once the grid has data items, it's possible to measure and use the actual rendered height of the first row. |
Right. Would it make sense to do some custom-property-fu here so that it could use |
Sure, we could use a custom property for it (and apply the min-width with |
@tomivirkki , is this done already? |
No, the prototype is there but it hasn't been worked on further |
I'd suggest to always use a fixed value for the body part:
The fixed value should probably be |
Describe your motivation
Placing a
vaadin-grid
withheight:100%
in a container without a defined height tends to result in the component rendering with a height of 0px. While this is in itself not a bug, it can be quite confusing for developers since the Grid renders effectively invisible on the page. This problem is somewhat unique to Grid, in the sense that most, if not all, other Vaadin components do have some kind of implicitmin-height
.Describe the solution you'd like
Apply a small default
min-height
on the Grid's root element, e.g. equivalent to 1 header row and 1 body row, so that developers can see that the Grid does render, and have a better chance of figuring out why it doesn't layout as expected.Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: