Thus far, we can create departments, and edit existing ones. Deleting departments is the next task we want to build into our application. Do the following:
All business objects have an action remove that will mark the object as removed. Pressing Save after Delete would achieve this but it is probably easier to commit the transaction immediately after you click Delete.
The last step is to ensure that the Delete button is disabled until there is actually an object to delete. This can be done by connecting the selectionIsValid attribute of the List part to the enabled attribute of the Delete button.
Note that when the TopLevelTransaction1 part has been committed once, it cannot be committed again. If this is done a walkback will occur informing you that you attempted to modify a read-only version of an object. This is because once the top-level transaction is committed, the shared transaction becomes the current transaction and a new top-level transaction must be begun. The next step is to modify the view such that we generate a new top-level transaction each time we commit an existing one.