Form View Event Hooks
Table of contents
Form views are usually used to show object attributes and details. Other object views like tab view or attribute view are built on top of the form view.
onViewAfterInit
Trigger
This event will be triggered after the form view has initialised all of its ui components including the editor components. This event hook can be used to set custom initial values after all attributes of the displayed object are loaded
Parameter
export class ObjectViewEvent {
type: string;
editorEvent?: EditorEvent;
tabView?: TabViewComponent;
parameter?: any;
}
export class EditorEvent extends BroadcastEvent {
attributeName: string;
resourceId: string;
resourceType: string;
}
Parameter example
Annotation
- Using
event.tabView.formName
to determine which form (defined in UI under settings -> editing form) fired the event - No
event.editorEvent
is needed - Using
event.tabView.getEditor()
to get an instance of an editor with desired attribute name
onViewEditorEvent
Trigger
This event will be triggered if any of the editors (text-editor, identity-picker etc.) have changed their value. This event hook can be used as event handler for the editors.
Parameter
Same as onViewAfterInit
Parameter example
Annotation
- Using
event.tabView.formName
to determine which form (defined in UI under settings -> editing form) fired the event - Using
event.editorEvent
to determine which editor fired which type of event - Using
event.tabView.getEditor()
to get an instance of an editor with desired attribute name
onViewBeforeSave
Trigger
This event will be triggered after the save button of a resource detail view is clicked and before the resource is indeed saved. This event hook can be used to do some finale work before a resource will be saved.
Parameter
Same as onViewAfterInit
Parameter example
Annotation
- Using
event.tabView.formName
to determine which form (defined in UI under settings -> editing form) fired the event - Using
event.tabView.getEditor()
to get an instance of an editor with desired attribute name - Using the following code to fire the save action, otherwise changes will not be saved
this.swap.broadcast({ name: 'save-attribute', parameter: param.parameter, });
onViewAddIdentities
Trigger
This event will be triggered after on or more identities are added into an identity-list. This event hook can be used to define the behavior when a multivalued attribute gets value(s) added.
Parameter
Parameter type is any
Parameter example
Annotation
event.values
holds the added values- Using
event.attribute
to determine which editor fired the event event.resourceID
can be used to get the displayed object
onViewRemoveIdentities
Trigger
This event will be triggered after on or more identities are removed from an identity-list. This event hook can be used to define the behavior when a multivalued attribute gets value(s) removed.
Parameter
Parameter type is any
Parameter example
Annotation
event.values
holds the removed values- Using
event.attribute
to determine which editor fired the event event.resourceID
can be used to get the displayed object
onViewRemoveAllIdentities
Trigger
This event will be triggered after the “remove all” button on the identity-list is clicked. This event hook can be used to define the behavior when a multivalued attribute is to be cleared.
Parameter
Parameter type is any
Parameter example
Annotation
event.values
is not needed- Using
event.attribute
to determine which editor fired the event event.resourceID
can be used to get the displayed object