Hi,
We are trying to use GridLayout to show details in grid. When opening detail by clicking on a row all components in the GridLayout are drawn on top of each other. When opening another row the previous one is drawn correctly. Tried also setting column expandratios but that didn’t help.
Here is simple sample program to demonstrate the problem.
[code]
@Override
protected void init(VaadinRequest vaadinRequest) {
GridLayout gridLayout = new GridLayout(1,1);
final Grid grid = new Grid();
grid.setWidth("1000px");
// Define some columns
grid.addColumn("text", String.class);
grid.addColumn("number", Integer.class);
// Add some data rows
grid.addRow("Row 1", 1);
grid.addRow("Row 2", 2);
grid.addRow("Row 3", 3);
grid.getColumn("text").setExpandRatio(2);
grid.getColumn("number").setExpandRatio(2);
grid.addItemClickListener(new ItemClickEvent.ItemClickListener() {
@Override
public void itemClick(ItemClickEvent event) {
Object itemdId = event.getItemId();
if(!grid.isDetailsVisible(itemdId))
{
grid.setDetailsVisible(itemdId, true);
}
else
{
grid.setDetailsVisible(itemdId, false);
}
}
});
grid.setDetailsGenerator(new Grid.DetailsGenerator() {
@Override
public Component getDetails(Grid.RowReference rowReference) {
GridLayout layout = new GridLayout(3,1);
layout.setSizeFull();
/*layout.setColumnExpandRatio(0, 2);
layout.setColumnExpandRatio(1, 2);
layout.setColumnExpandRatio(2, 2);*/
layout.addComponent(new Label("One"),0 , 0);
layout.addComponent(new Label("Two"),1 , 0);
layout.addComponent(new Label("Three"),2 , 0);
return layout;
}
});
gridLayout.addComponent(grid, 0, 0);
this.setContent(gridLayout);
}
[/code]Br,
Simo Tuokko