Client Events
Copy
There are several Events available on the client side, including:
- Form Events
- Field Events
- Grid Events
- Data Store Events
- Item Type Events
- Item Actions
Context Item
The this keyword context Object is an Item Object for Item Actions. However, the context Object is not the Item Object for Form, Field, and Grid Events. This context Object is the browser document (DOM) Object for the Form and Grid Events and is the Field Object for Field Events.
The context Item Object for Form, Grid, and Field Events is the document.thisItem Object, which is an Item Object and should be used with the IOM API. For relationship grid events use parent.thisItem, which is a pointer to the document.thisItem Object.
Form Events
The Form Events are the HTML page events; for example, onLoad, onUnload, onResize, onMouseDown, onMouseUp, and others (refer to the ‘Form Events’ List in Aras Innovator for the complete list of available events.)
You bind your Method to the Form Event using the Form Tool. Select the Form Event tab and add the event relationships as shown below:
Field Events
The Field Events are the HTML field events; for example, onSelect, onClick, onChange, onBlur, onFocus, and others (refer to the ‘Field Events’ List in Aras Innovator for the complete list of available events.) Use the following procedure:
- Bind your Method to the Field Event using the Form Tool.
- Select the Field by clicking on it in the canvas area in form Tool or from the Fields grid in the upper left-hand corner of the Form Tool.
- Select the Field Event tab and add the event relationships as shown here:
Grid Events
Grid Events are the events for the grid control, which is used in the Relationships tab area for tear off Item windows. The grid events occur on the row (section Row Events) and on the cell (section Cell Events.)
Like Server Events you bind a Method as the callback for the event as the Grid Event relationship on the RelationshipType Item, and as the Grid Event relationship on the Property Item.
The Method gets at least three arguments: relationshipID, relatedID, gridApplet. The relationshipID is the ID for the relationship Item for the selected row. The relatedID is the ID for the related Item for the selected row. And the gridApplet is a handle to the grid control object. The relatedID may be empty if there is no related Item for the relationship row. The relationshipID is also the ID for the grid control row. Edit the RelationshipType Item and add Grid Events relationships as shown here:
Row Events
The row events include:
| Event | Comment |
| onSelectRow | Fires when the row is selected. |
| onInsertRow | Fires when the row is inserted. |
| onDeleteRow | Fires when the row is deleted. |
The Method for the event is called with three arguments:
| Argument | Type | Comment |
| relationshipID | String | The ID for the relationship Item. This is also the selected row ID for the grid control. |
| relatedID | String | The ID for the related Item. The relatedID maybe empty if there is no related Item for the relationship row. |
| gridApplet | GridControl | The handle to the grid control. |
Cell Events
Edit the Property Item and add Event relationships as shown here:
The cell events include:
| Event | Comment |
| onEditStart | Fires when the cell gets focus. |
| onEditFinish | Fires when the cell loses focus. |
| onChangeCell | Fires when the cell value changes. |
| Default Search | |
| onSearchDialog |
The Method for the event is called with five arguments:
| Argument | Type | Comment |
| relationshipID | String | The ID for the relationship Item. This is also the selected row ID for the grid control. |
| relatedID | String | The ID for the related Item. The relatedID may be empty if there is no related Item for the relationship row. |
| gridApplet | GridControl | The handle to the grid control. |
| propertyName | String | The name of the Property for the cell column selected. |
| colNumber | Integer | The column position number in the grid |
Data Store Events
Data Store Events are client-side events that trigger when the Aras Innovator client tries to update its internal data store. The data store is a mechanism that helps sync the state of data across the client. This means that a data store event will trigger regardless of the UI control that updates the data store. So instead of creating multiple client events for grids, forms, fields, etc., a developer can create a single event that will execute if data is updated in any of those controls.
There are 2 event types implemented for the data store.
- Validate: Method runs prior to updating the property in the data store. The method logic may cancel the update and return an error message to the user.
- Change: Method runs after a property has been updated in the data store. The method logic may manipulate the item in the data store.
Data store events are configured similarly to grid cell events – on an ItemType’s properties.
It is important to note the following about data store events:
- Data store events are client-side events and do not directly update the data in the database.
- Data store events cannot directly manipulate UI controls in the client. For example, a Validate data store event could prevent a user from updating a property and return an error message telling them why. However, the event could not disable a grid cell or form field for the property, because those are UI controls.
- Data store events should not be configured on the properties of Poly ItemTypes. These events should be configured on the properties of the poly source ItemTypes instead.
Item Type Events
Client Events that can be attached to an Item Type are triggered when your UI actions generate a new Item. These events are triggered from the client interface regardless of UI context or where in the GUI the new Item creation was initialized. These events would be triggered universally from the Main Menu, the TOC RMB menu, the Main Grid RMB menu, Relationship Grid, etc.
For Item Type new item creation, 3 events have been implemented. One event is triggered before a new Item is created; another event is triggered after an Item has been created; the third event replaces the standard client ‘new Item’ logic.
onBeforeNew: Method runs prior to a new Item creation. It can cancel subsequent client operations (i.e., form opening). It can cancel creation of new Items.This event is often used to validate current conditions and determine if it is ok to create a new Item.
onAfterNew: Method runs after a new Item is created. Subsequent standard client logic is executed following method completion (i.e., form opening). Method is passed a new Item.This event is often used to populate a new item with data and open custom dialogs.
onNew: The method replaces the standard ‘new Item’ client behavior.This event is used in special situations where a solution must maintain full control over the new Item creation process.
onBeforeNewand
onAfterNewevents are assigned to the same ItemType and therefore executed sequentially.
Item Actions and Server Event
The Methods related to the ItemType via the ‘Item Action’ relationship are called via the action attribute and the Item.apply() method. Review them by searching the ‘Item Actions’ Tab on the ItemType.
The Methods related to the ItemType via the ‘Server Event’ relationship are called by the server as pre and post event callbacks for the primitive server actions: add, update, delete, and get. Review them by searching the ‘Server Events’ Tab on the ItemType.
Review the Generic Methods by searching the Method Items.