3 possible solutions:
1. Dirty workaround :
Instead of getName() return getName() + with some unique identifier:
public String getValue(IrrigationGapDTO object) { if (object.getProgramSelected()!=null) return object.getProgramSelected().getName()+"_"+object.getUniqueIdentiufier(); else return ""; }
then in FieldUpdater you can divide by the symbol "_" and process duplicates
2. Use a unique identifier instead of getName() : Just create / assign a unique identifier to your programs and use it instead of a name.
3. Use IrrigationProgramDTO instead of String :
Instead of String you can use the IrrigationProgramDTO class in the column definition. However, you may have to use a custom SelectionCell, which instead of String uses the IrrigationProgramDTO type instead of the data type.
Column<IrrigationGapDTO, IrrigationProgramDTO> categoryColumn = new Column<IrrigationGapDTO, IrrigationProgramDTO> (categoryCell) { @Override public IrrigationProgramDTO (IrrigationGapDTO object) { if (object.getProgramSelected()!=null) return object.getProgramSelected(); else return null; } }; categoryColumn.setFieldUpdater(new FieldUpdater<IrrigationGapDTO, IrrigationProgramDTO>() { public void update(int index, IrrigationGapDTO object, IrrigationProgramDTO value) { object.setProgramSelected(program); } }
Γmit source share