Hi all, i have the following problem:
I create a table and set an SQLContainer as its datasource like this:
private void initContainers() {
try {
TableQuery q1 = new TableQuery("sm0kers", connectionPool);
q1.setVersionColumn("VERSION");
smokerContainer = new SQLContainer(q1);
smokerContainer.setAutoCommit(false);
TableQuery q2 = new TableQuery("gcmids", connectionPool);
q2.setVersionColumn("VERSION");
regidContainer = new SQLContainer(q2);
regidContainer.setAutoCommit(false);
smokerContainer.addReference(regidContainer, "idreg", "regid");
} catch (SQLException e) {
e.printStackTrace();
}
}
@SuppressWarnings("serial")
public class Smoker extends Table {
public Smoker(final PolwebUI app) {
setSizeFull();
addGeneratedColumn("idreg", new ColumnGenerator() {
public Component generateCell(Table source, Object itemId,
Object columnId) {
if (getItem(itemId).getItemProperty("idreg").getValue() != null) {
final ComboBox cb = new ComboBox();
return cb;
}
return null;
}
});
setColumnHeader("idreg", "Codice Reg");
setContainerDataSource(app.getDbHelp().getSmokerContainer());
setEditable(true);
setSelectable(true);
setImmediate(true);
}
}
table = new Smoker(this);
table.setVisibleColumns(new Object { "id", "email", "nick", "pass","idreg"}
I want to fill the combobox with values from regidContainer and make the smokerContainer to commit the row with the value selected by the user. I really cannot figure out how to achieve this. I’m searching and searching on google and vaadin forum but cannot find an answer.
Thanks in advance for any kind of help