0
votes

In one form I have system OK button :

@Order(910.0)
public class SaveButton extends AbstractOkButton {

  @Override
  protected String getConfiguredLabel() {

    return TEXTS.get("Save");
  }
}

and I have tableField ...

If I add new empty row in this table execStore is called when pressing save button, but if I delete this empty row and press save button nothing is called, button only close form.

How to solve this? I would like to be able to delete empty row.

EDIT :

I figure it out that all rows where only smart fields are filled in, on delete it doesn't detect change. (not only empty rows...)

Problem is that checkSaveNeeded of the form return that nothing was changed in doOk method.

1

1 Answers

0
votes

How do you add your row?

You can mark the row as inserted or not. See: addRow(newRow, markAsInserted); on the Table.


You second question is "How does a Table Field computes if the form needs to be stored or not"?

You can implement you custom logic on with execIsSaveNeeded(). See this question on the Scout forum: https://www.eclipse.org/forums/index.php?t=msg&th=477037&goto=1042295#msg_1042295


Your last point is: when a row has the status ITableHolder.STATUS_NON_CHANGED in an editable table. When the value in a SmartColumn is changed with a SmartField, the status of the row is not changed to ITableHolder.STATUS_UPDATED.

I just tested it and it works as expected.


For row deletion, it depends on how your table field is configured. What is the value of the property isAutoDiscardOnDelete().

The doc here is still valid with Neon: Table > Delete a row from the table

With isAutoDiscardOnDelete() returning true (this is the case if getConfiguredAutoDiscardOnDelete() returns true), when you remove a row in your table field, it is discarded. There is nothing to save because there is no deleted row in the table field (Everything is explained in the wiki section I have mentioned)

If you want to persit a deletion on the server, you should not use discard the row but just delete it. This way you get the information in the FormData and from there you can work with the row status as described here: TableData (again old doc from our wiki, because it works like this since years. This it not new with Neon).