Hi,
is there any easy way to implement a table that has rows that can be opened, like in here: [url=http://img265.imageshack.us/img265/8572/itmilldemozs0.jpg]
[img=http://img265.imageshack.us/img265/8572/itmilldemozs0.jpg]
[/img]
[/url]
I have tried with
getTable().addItemAfter(timeTable.getId(), rowLayout);
without much success because when I click open button it opens one row after current row, but in this case it’s empty and the row where I clicked also lost some content, see [url=http://img401.imageshack.us/img401/5167/itmilldemo2yo6.jpg]
[img=http://img401.imageshack.us/img401/5167/itmilldemo2yo6.jpg]
[/img]
[/url]
Here’s my
getTable().addContainerProperty(PROPERTY_IS_SELECTED, Button.class, "",
"", null, null);
getTable().addContainerProperty(PROPERTY_NAME, CustomLayout.class,
null, "", null, null);
[code]
for (TimeTable timeTable : timeTables) {
CheckBox checkbox = new CheckBox(“”, this, “checkboxClick”);
checkbox.setData(timeTable);
Button button = new Button("Näytä", this, "buttonClick");
button.setData(timeTable);
CustomLayout rowLayout = new CustomLayout("rema/time_table_row");
rowLayout.addComponent(new Label(timeTable.getName()), "nameLabel");
rowLayout.addComponent(button, "infoButton");
// This is much faster than adding item properties one by one
getTable().addItem(new Object[] { checkbox, rowLayout },
timeTable.getId());
counter++;
}
[/code][code]
public void buttonClick(Button.ClickEvent event) {
TimeTable timeTable = (TimeTable) event.getButton().getData();
CustomLayout rowLayout = new CustomLayout("rema/time_table_row");
rowLayout.addComponent(new Label("TESTIII"), "nameLabel");
getTable().addItemAfter(timeTable.getId(), rowLayout);
}
[/code]
- markus