ObjectExtender User's Guide and Reference

Deleting departments

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:

  1. Drop a Push Button part on the Window part and label it: Delete
  2. Connect the clicked event of the Delete button to the remove action of the TstDepartment1 variable.

    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.

  3. Connect the clicked event of the Delete button to the commit action of the TopLevelTransaction1 part.

    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.

  4. Test the view. It is possible now to add, edit, and delete departments.


Figure pgs1dele not displayed.

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.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]