UI Event Actions - v22-appfactory/appfactory-wiki GitHub Wiki
UI Event / Actions are based on three tables:
- events - The UI events that are supported
- add - Add a record.
- edit - Edit a record.
- delete - Delete a record.
- load - Load a page.
- submit - Submit form; insert or update a record.
- goto - Simple navigation to another page.
- gotoDataItem - Save a specified data element for editing and navigate to another page.
- loadeditcomplete - Action to take after a loadedit or loaddetail have completed.
- actions - The actions that can be taken when the event occurs
- navigate - Navigate to a different page.
- clear - Clear the form; often paired with a submit event.
- update - This was probably included to update the screen, but it is currently not used.
- query - Perform a query.
- loadedit - Load a form with a record so that it can be edited.
- loaddetail - Retrieves a record and then loads the form with a record so that it can be edited.
- userattachments - Retrieves a list of attachments and sets the attachment data in the form.
- relatedrecord - Retrieves a related record and then loads the data retrieved.
- reloadresource - This action is intended to reload resources (select options).
NOTE: This may not have any impact since this can be set in a formio form - filteredquery - Performs a "filtered" query and sets the form data with the result. The query is basically a custom query that can use field/column values in the search.
- formeventactions - The table that defines the pageform/event/action or "page actions"
Event/Action pairings are defined for a page form. Records are created in the administration page Form Actions Maintenance. When a page is selected a request is made to the services back-end to return the pageform JSON that renders the page's form. As a part of the request an array of page actions are returned. When the user performs a gesture that results in an event firing the event is sent to the event handler defined for the event. Event handlers that use a 'page action' look for a formeventactions record defined for the pageform/event/action and, if found, use the page action to execute the action.
- id - unique record ID
- eventid - ID of the event
- actionid - ID of the action
- actiondata - the data used to execute the action
- pageformid - ID of the page form or for an adhoc query
- adhocqueryid - for a page form or the ID of an adhoc_queries record
A dashboard request for a dashboard that uses an ad hoc report to retrieve records also can return event/actions used for the actions in the results datatable. An example would be an event/action to handle a user click to edit a row in the datatable. The formeventactions record for this case will have a null value in the pageformid and will have the adhoc query ID in the adhocqueryid column. This associates the formeventactions record with the ad hoc query.
The actiondata contains JSON that is used to execute an action. If non is needed an empty object is used ('{}'). The JSON object properties can either be hardcoded values or an object property name. A simple example of hardcoded values would be the params for the 'navigate' action where navigation is to a specified page to edit a record. The 'loaddetail' action is an example of providing an object property name where the value is dynamic and loaded from the current form and item being edited.
The actiondata for the current actions are the following (the params that are hard coded use examples and explain what the value represents):
- navigate - {"path":"/apps/10/96"}
- 10 : appid - application ID
- 96 : pageid - page ID to navigate to
- clear - {}
- update - N/A
- query - { "url": "/appform/datatable/118" }
- 118 : apptablesid - retrieves all records from the tables using the apptablesid
- loadedit - {"path": "/apps/10/81"}
- 10 : appid - application ID
- 81 : pageid - pages table ID
NOTE: the record to edit should have been committed to the store object editRecords
store.getters.editRecords[pageid]
- loaddetail - { "url": "/appform/record/:formid/:recordid" } : formid and recordid are provided by the current page data
- :formid - pageform ID; the pageform provides the appcolumns ID which provides the table/column to search
- :recordid - ID of the record to return
- userattachments - { "component": "attachment" } : data is currently not used
- relatedrecord - { "url": "/appquery/1", "params": { "recordid": ":id", "appcolumnid": 485 } }
- reloadresource - N/A
- filteredquery - {"url": "/appform/datatable/390", "method": "post", "params": {"sortBy": "createdat", "searchValue": ":id", "searchColumn": "issueid"}}
- 390 : apptablesid - the table to search
- searchColumn - column for the where clause
- searchValue: :id - search value for the where clause : value is provided from the specified item property
NOTE: This action builds a query using the 'method' and 'params' on the table specified.