Situation: Assume you have a simple grid, with only 2 columns. First column is frozen. You're trying to join the 2nd column with additional header.
Problem: after joining the column, the column captions (in the header cells) of all columns disappear.
Code to reproduce:
Grid table = new Grid();
HeaderRow header = table.addHeaderRowAt(0);
Column c1 = table.addColumn("C1", String.class);
table.setFrozenColumnCount(1);
Column d1 = table.addColumn("D1", Short.class);
c1.setHeaderCaption("Frozen col");
d1.setHeaderCaption("1/10");
header.join("D1");
table.addRow("Example name", (short)25);
Without join:
With join:
Am I doing something wrong or this is a Vaadin bug?
Vaadin version: 7.7.0
Regards
答案 0 :(得分:1)
您需要加入两个列:
header.join("C1", "D1");
来自.join(Object... propertyIds)
功能:
assert propertyIds.length > 1 : "You need to merge at least 2 properties";
答案 1 :(得分:0)
我遇到了同样的问题(Vaadin 8.5.0)。如果只有一列,则无需调用header.join(...)
。而是通过调用HeaderCell headerCell = headerRow.getCell("D1")
获取标头单元。您仍然可以设置headerCell
的组成部分或文本。