代码之家  ›  专栏  ›  技术社区  ›  Steffen Harbich

瓦丹流动网格没有高度

  •  1
  • Steffen Harbich  · 技术社区  · 6 年前

    我有下面的<代码>网格<代码>显示Java系统属性:

    SystemPropertyGrid=new grid<>();
    SystemPropertyGrid.SetItems(BuildSystemProperties());
    SystemPropertyGrid.AddColumn(SystemProperty::GetProperty).setHeader(“Property”).setFlexGrow(1);
    SystemPropertyGrid.AddColumn(SystemProperty::GetValue).setHeader(“Value”).setFlexGrow(5);
    系统属性网格.setheight(“500px”);
    

    当我替换setheightbysetheightbyrows(true)但是,只要我不指定SystemPropertyGrid.setHeightByRows(true)The grid has a calculated height of 2 pixels in the browser(firefox,edge)which is the border.但是,元素样式heightis correctly set to500pxas I can see in firefox developer tools.

    瓦丹流中的臭虫?浏览器最终不使用元素样式height

    屏幕截图:

    使用Vaadin流动弹簧启动器的SSCCE: my-starter-project_51443246.zip.>打电话给Maven Goal Springboot:run.&p

    当我替换setHeight通过setHeightByRows(true). 但一旦我没有具体说明systemPropertyGrid.setHeightByRows(true)网格在浏览器(firefox,edge)中的计算高度为2像素,即边界。但是,元素样式height正确设置为500px正如我在Firefox开发者工具中看到的。

    瓦丹流中的臭虫?浏览器不使用元素样式的可能性有多大?高度最终?

    截图: Grid that is filled with items and height set to 500px but is actually 2px high

    使用Vaadin流动弹簧启动器的SSCCE: my-starter-project_51443246.zip. 打电话给Maven Goal Springboot:run。

    2 回复  |  直到 6 年前
        1
  •  3
  •   Mehdi Javan    6 年前

    你是对的。它在Firefox中不起作用,而在Chrome中起作用。您可以在中提交问题 GitHub . 作为解决方法,如果设置父级的高度 VerticalLayout 在Chrome和Firefox中都可以使用。因此,添加以下语句:

    setHeight("500px");
    
        2
  •  1
  •   peterh    6 年前

    固定在 Vaadin Grid v5.0.5 已作为 瓦丹10.0.9 瓦丹11.0.4 . 所以你需要确保使用其中的任何一个。(当然,在最初发布时没有发布)

    推荐文章