|
Our goal is to give the possibility to the user to delete employees from the application. The user will be able to select the employees from the list and delete their data.
In order to accomplish this example, it is necessary to go through the following steps:
- Add a Page to the Site View: select the "Page" icon from the palette, and place it on the Site View. Change the page name (setting "Delete Employees") and other properties in the Properties View (such as "Home" or "Landmark" properties) to make the page accessible.
- Add a Power Index Unit to the page: select the Power Index Unit icon from the palette and place it inside the page. Change the "Name" property in "Employee List".
- Set the Entity on which the Power Index Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Employee" Entity from the opened dialog pane.
- Choose which attributes of the selected Entity must be shown: click on the "Edit" button of the "Display Attributes" property. Then choose the "name", "surname", "hire date" and "company" attributes from the opened dialog.
- Define the sort criteria of the Power Index Unit: click on the "Edit" button next to the "Default Sort Attributes" property, then choose the "surname" attribute and the "ascending" sort criteria. Since the Power Index Unit is dinamically sortable, set the "Sortable" property to true and the "Sort History Size" property to 1.
- Define the division of the Employee List in pages: select the Power Index Unit, set the "Block Factor" property to "10" and the "Block Window" property to "10".
- Add a Delete Unit: select the Delete Unit icon from the palette and place it inside the Web Model. Change the "Name" property in "Delete Employees".
- Set the Entity on which the Delete Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Employee" Entity from the opened dialog pane.
- Draw a normal link between the "Employee List" Power Index Unit and the "Delete Employees" Delete Unit: select the Link button from the palette and click on the "Employee List" Power Index Unit (the Source of the Link) and then on the "Delete Employees" Delete Unit (the Target of the Link). Set the Name property of the newly created Link to "Delete" and the Type property to "normal".
- Define the parameters coupling: open the Parameters Coupling window of the newly created link in order to define the coupling between the output parameters of the source Unit and the input parameters of the target Unit.In the Parameters Coupling dialog, couple the "oid" Attribute of the Power Index Unit with the automatically created Key Condition of the Delete Unit.
- Draw an OK link between the "Delete Employees" Delete Unit and the "Delete Employees" Page: select the Link button from the palette and click on the "Delete Employees" Delete Unit (the Source of the OK Link) and then on the "Delete Employees" Page (the Target of the OK Link). Set the Name property of the newly created OK Link to "Employee deleted".
- Generate the Web application: click on "Generate Full Web Project" on the WebRatio Menu Bar. Once the generation process has completed, it is possible to start the application server and test the Web application.
|
The Web Model of the example
|
The Properties View of the Power Index Unit
|
The Properties View of the Delete Unit
|
The Parameters Coupling window
|
|