Thursday, May 2, 2024

VBCS - work with events and events listeners

  • An event occurs when something happens in your application.
  • Some examples are when a page loads (lifecycle event), a button is clicked (component event), and when a variable's value changes (variable event). 
  • An event's type depends on how it is triggered; for example, a button or a menu would trigger a component event

Type of events:

Component events:

  • An event associated with a UI component in a page, including those in dynamic components.
  • It’s possible to choose which event the component triggers, but available events will depend on the component. For example, an event like ojAction is available to a button but not to an input text field.

Variable events:

  • An event specific to a variable that occurs when the value stored in the variable changes.
  •  The only available variable event is onValueChanged.

Custom events:

  • A user-defined event that can only be triggered by the Fire Event action (fireCustomEventAction) in an action chain.
  • You use custom events to trigger an action chain from another action chain or JS function.

Lifecycle events:

Predefined events that are automatically triggered during a page’s lifecycle:

  • vbBeforeEnter is triggered before navigating to a page.
  • vbEnter is triggered when all flow or page variables have been initialized.
  • vbBeforeExit is triggered before leaving a page.

    The vbBeforeExit event optionally allows navigation to be canceled (say, when a page has unsaved changes) by returning an object with the property cancelled set to true. When using the browser (back or forward button), the event's payload is an object containing default parameter values. 

  • vbExit is triggered before leaving a flow or page.
  • vbAfterNavigate is triggered when navigation to the page is complete.

You can associate action chains with these events to augment a page or flow's default lifecycle. For example, if you want to initialize some component variables when a page opens, you can create an event listener in your artifact that listens for the vbEnter event, then set the event listener to trigger an action chain that assigns values to the component's variables.


No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...