CRUD
Overview
The CRUD page type is one most flexible tools in Portofino, and often the most frequently used one.
As the name suggests, a CRUD page is based on the four fundamental operations (Create, Read, Update, Delete) that can be performed on a database record. In addition to these are a number of other, also important operations:
- Search by criteria
- Bulk edit and bulk delete of multiple records
- PDF export
- Excel export
- Results pagination: viewing only 10 results at a time, rather than all at once.
- Results navigation: moving from one record to the next one or previous one.
A CRUD page is flexible because it allows you to:
- Pre-filter the records with a WHERE clause. This is in addition to any search criteria.
- Display only some of the columns among those available in a table.
- Decide which columns are editable and which are read-only.
- Treat tables with large numbers of records slightly differently, to improve performance.
These configurations are discussed in greater detail in the CRUD configuration.
Search
The search page is the first one you see when you visit a CRUD.
Let's analyze its structure, from top to bottom:
- A search criteria area, which is initially collapsed, can be expanded by pressing the "Search >>" link.
- A row of navigation buttons, to navigate results quickly.
- A table displaying the search results
- Another row of navigation buttons.
- A row of operation buttons.
In the search results, the first column of checkboxes allows you to select one or more records for bulk operations.
The search criteria area, when expanded, is shown as follows.
To start a search, enter any criteria you like and then press the Search button. To reset all criteria, click on "Reset Form".
Create
From the Search page, click on the Create button. A form to create a new record is presented.
Some fields are editable, others are read-only, depending on the CRUD configuration. Auto-generated fields (e.g. primary keys) are read-only and will be populated once the record is saved.
Click on Save to confirm the creation.
If the values you have entered do not pass validation, the form is be presented again, and the incorrect field(s) are marked with an error message.
Read
From the search page, click on a record's link to read (view) its details.
This is a read-only view of the record's data. A number of buttons is included for the most common operations: Edit, Delete and PDF/Excel export.
Update
From the read page, click on Edit to edit the record. A form is be presented. Some values are be editable, others may be read-only, depending on your configuration.
Click on Update to save the changes.
Delete
From the read page, click on Delete to delete the record. You will be asked to confirm the operation.
Bulk actions
Bulk actions include edit and delete on multiple records. From the search page, select one or more rows using the checkboxes. Then click on Edit or Delete.
The bulk edit form is a modified version of the normal edit form. On the left side of the form is a column of checkboxes. Select the fields that you want to modify and enter a value. The fields that you leave unselected will not be affected by the update.
Click on Update to confirm the operation.