我有一个包含组合框列的表,在组合框的 valueChange 侦听器中我生成另一列。所有人都认为没问题,添加了第二列,但我失去了组合框的价值,它被重置了。据我了解, generateCell 函数运行两次。你可以帮帮我吗?你可以在下面看到我的代码:
getTable().addGeneratedColumn("action", new Table.ColumnGenerator() {
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
ComboBox comboBox = new ComboBox();
comboBox.addListener(new Property.ValueChangeListener() {
@Override
public void valueChange(Property.ValueChangeEvent event) {
taskTable.getTable().addGeneratedColumn("rejectReason",
new Table.ColumnGenerator() {
@Override
public Object generateCell(final Table source1, final Object itemId1, Object columnId1) {
ComboBox comboBox1 = new ComboBox();
comboBox1.select((comboBox1.getContainerDataSource()).firstItemId());
return comboBox1;
}
}
);
}
});
return comboBox;
}
});