Main Page: Select Book to Edit
When we want to edit a book, we want to bring up that book's details in an editable format. We will implement this using the following mechanism:
•Use a separate page, where only the details of the selected book are displayed in an editable format. In our tutorial, this is the subpage Editing Page.
•The DB page source of Editing Page must select only the particular author and the particular book to be edited. The edited data will be saved back to the respective records in the Authors and the Books tables of the DB.
•When the user selects a book to edit, we save its author ID and book ID to the \$PERSISTENT tree (in the EditAuthorID and EditBookID nodes, respectively).
•These values in the \$PERSISTENT tree are passed to the subpage for the selection of the data from the DB.
The steps of the mechanism are described in detail below.
Select IDs for book to edit
On the main page, every table cell that displays book information (screenshot below left) is given the same set of actions (screenshot below right). These are set on the control in each cell.
Two parameters are passed to the Action Group Edit Author: \$AuthorID and \$BookID (see screenshot above right). These parameters are given values via XPath expressions that return the selected book's author ID and book ID, respectively (see screenshot above right).
The Edit Author Action Group (screenshot below) does the following: (i) updates the \$PERSISTENT tree nodes that hold the ID information about the currently selected book; (ii) opens the Editing Page subpage as a modal dialog; (iii) after the edited record has been saved from the subpage and the subpage has been closed, the main page is refreshed with the reloaded \$BoookCatalog page source. Consequently, the newly edited data will be displayed immediately in the main page.
How data is selected for the subpage is described in the topic Editing Page: Overview.