0
votes

I have table field with editable column. When I change value in one cell I need to calculate value in other fields. I would like to know, how to detect when value in cell has change. I couldn't find any hooks that will tell me that value in cell has change.

I found :

@Override
public void fireTableEventInternal(final TableEvent e) {

  if (e.getType() == TableEvent.TYPE_ROWS_UPDATED) {
    AbstractProductsTableField.this.execPriceValueChange();
  } else {
    super.fireTableEventInternal(e);
  }
}

but I don't think this is a way to go.

1

1 Answers

2
votes

I think that execCompleteEdit is the function you need.

@Order(10)
public class MyColumn extends AbstractStringColumn {

  @Override
  protected String getConfiguredHeaderText() {
    return "MyColumn";
  }

  @Override
  protected void execCompleteEdit(ITableRow row, IFormField editingField) {
    //Test if there is a new value:
    //compare getValue(row) and ((IStringField) editingField).getValue()

    //Call super to store the value to the cell (default behavior):
    super.execCompleteEdit(row, editingField);
  }
}