Grid manages this style from the client side and we can not and should not control this directly.
But Grid component provides a way to show the hidden data or details by DetailsGenerator
.
However, for header we can not do anything as the only solutions is to keep header small and descriptive as possible. But still in my opinion word wrap on header will not look nice.
Following examples manages visibility of details on item selection,
Grid g = new Grid();
g.addColumn("num");
g.addColumn("val");
g.setWidth(400, Unit.PIXELS);
g.setHeight(300, Unit.PIXELS);
g.getColumn("num").setWidth(100);
g.getColumn("val").setWidth(300);
g.addRow("1", "This is just a simple test. No need to take it too seriously, please !!!!");
g.addRow("2", "This is just a simple test. No need to take it too seriously, please !!!!");
g.addRow("3", "This is just a simple test. No need to take it too seriously, please !!!!");
g.addRow("4", "This is just a simple test. No need to take it too seriously, please !!!!");
g.addItemClickListener(new ItemClickListener() {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void itemClick(ItemClickEvent event) {
g.setDetailsVisible(event.getItemId(), !g.isDetailsVisible(event.getItemId()));
}
});
g.setDetailsGenerator(new DetailsGenerator() {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public com.vaadin.ui.Component getDetails(RowReference rowReference) {
String value = (String)rowReference.getItem().getItemProperty("val").getValue();
Label val = new Label();
val.setValue(value);
val.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
return val;
}
});
