Alternate Client Configurations
Extended Entity Editor Panel
Instead of an editor.panel.simplegrid
editor view control, the client can be configured to enable interaction with different editor types under the one tab.
<view id="editor.panel">
<label>Edit</label>
<location>west</location>
<edit>e.graffiti_address</edit>
<edit>r.graffiti_visit</edit>
</view>
In this example the r.graffiti_visit
editor is a related editor config for the graffiti
entity (the e.graffiti_address
editor is an entity editor config for graffiti
), and so the editor panel will display an address form and a graffiti visitor’s grid.
For the entity (address) panel the existing (displayed) data can be edited in place and committed to the database via the Submit button which causes the existing record to be replaced. If no address record exists for an entity the panel’s entries will be blank: entering data and pressing Submit will cause a new record to be created in the database.
The Create button for the visit data will cause a new data entry form to appear. Entering data and pressing Submit will cause a new record to be committed to the database and the visit grid updated to show the new record.
Create Button Showing Input Form
|
|
If an existing record appears in the Visit grid, it can be updated by selecting the row, pressing Update, entering the new data and pressing Submit.
|
|
Combined Grid
There is a powerful editor panel called the editor.panel.combinedgrid
. The power of this editor is that it allows both the creation of new non-spatial data for an entity, and the editing of existing non-spatial row data.
This can be shown by configuring the client to use the editor.panel.combinedgrid
panel to interact with the r.graffiti_visit
(related table) editor:
<view id="editor.panel.combinedgrid">
<label>Graffiti Visits</label>
<location>west</location>
<edit>r.graffiti_visit</edit>
<labelAlign>left</labelAlign>
<enableCreate>true</enableCreate>
<enableDelete>true</enableDelete>
</view>
Initially this looks like this:
We can then create a new visit record as follows. Note how when we press the Create button a new form appears below the line which allows for the data to be entered.
Which when we press Submit we get the following:
We can edit any record by selecting the record in the grid, which causes the record to appear in the form. In the form below we change the Visit Date from 2024-01-05 to 2024-01-06.
When Submit is pressed the grid record is updated:
To delete a visit record simply select a record in the grid (only one can be selected at a time) - the selected record will appear in the edit form below - then press the Delete button.
A confirmation dialog box will be displayed.
Pressing Yes will result in the following.
As can be seen, the combined editor is very powerful.
Combined Grid and Multiple Editors
One last aspect of the combined editor is that it can handle multiple editors at a time.
This can be done by adding multiple <edit> tags to the editor.panel.combinedgrid
panel:
<view id="editor.panel.combinedgrid">
<label>Graffiti</label>
<location>west</location>
<edit>r.graffiti_visit</edit>
<edit>e.graffiti_address</edit>
<labelAlign>left</labelAlign>
<enableCreate>true</enableCreate>
<enableDelete>true</enableDelete>
</view>
Updating the client XML results in the following “Graffiti” labelled tab:
Selecting Visit shows the visit panel.
Selecting Address shows the address panel (with an address selected).