我有以下 Grid
显示 Java 系统属性:
systemPropertyGrid = new Grid<>();
systemPropertyGrid.setItems(buildSystemProperties());
systemPropertyGrid.addColumn(SystemProperty::getProperty).setHeader("Property").setFlexGrow(1);
systemPropertyGrid.addColumn(SystemProperty::getValue).setHeader("Value").setFlexGrow(5);
systemPropertyGrid.setHeight("500px");
当我将 setHeight
替换为 setHeightByRows(true)
时,会显示所有项目。但是,只要我不指定 systemPropertyGrid.setHeightByRows(true)
,网格在浏览器(Firefox、Edge)中的计算高度为 2 像素,这是边框。但是,元素样式 height
已正确设置为 500px
,正如我在 Firefox 开发人员工具中看到的那样。
Vaadin Flow 中的错误?浏览器最终不使用元素样式 height
怎么可能呢?
使用 Vaadin Flow Spring 启动器的 SSCCE: my-starter-project_51443246.zip .调用 maven 目标 springBoot:run。
最佳答案
你是对的。它在 Firefox 中不起作用,但在 Chrome 中有效。您可以在 GitHub 中提交问题.
作为解决方法,如果您设置父级 VerticalLayout
的高度,它在 Chrome 和 Firefox 中都有效。因此,添加以下语句:
setHeight("500px");
关于Vaadin Flow Grid 没有高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51443246/