如何防止网格小于最小高度?

时间:2016-02-07 13:18:11

标签: javascript java gwt vaadin vaadin-grid

我使用vaadin-grid并且在选择行时想要使用行详细信息视图。只要表有很多行,这就可以工作。假设您过滤了一些表数据,表变小了

enter image description here

当您选择一行时,由于网格太小,您将无法再看到行详细信息视图。

如何防止网格小于最小高度?

1 个答案:

答案 0 :(得分:0)

您可以使用数据容器重新计算详细信息生成器内的网格高度。它不是最终的解决方案,但它可以完美地满足我的需求,即动态改变网格高度而不需要内部滚动条。

Grid table...
table.setHeightMode(HeightMode.ROW);
table.setDetailsGenerator(new DetailsGenerator() {

   public Component getDetails(RowReference rowReference) {
      table.setHeightByRows(tableContainer.getItemIds().size() + 4);
      //detalis height is constant so I solve this by adding extra space which equals the size of 4 the rows
      //
      //for filtered container you can use tableContainer.getVisibleItemIds()
   }
}

希望有所帮助。如果您找到更好的解决方案,请在此处发布。我没有这样做,但是将组件标记为脏内部细节生成器呢?