Enable Asynchronous Handling for Component Events

Some JET components, particularly editable tables, support asynchronous event handling—but you must explicitly enable this behavior for events in your VB Studio application. If you enable this behavior on existing event listener configuration, make sure you rework your existing action chains to manage the async event.

Here's a scenario when you might want to enable async event handling: When working with editable tables, users often edit a single row (data) at a time, with a currentRow variable being used to track the row being edited. When a user moves out of one row and into the next, the application is notified of the change through the table’s events: ojBeforeRowEdit and ojBeforeRowEditEnd.

When these events use non-async event behavior, the user may see data from the previously edited row (previous row) flash briefly in the new row that is being entered (next or new row). This occurs because of a split-second delay between the previous row going out of edit mode and the next row going into edit mode, both of which happen in parallel as they both use the currentRow variable. This delay—wherein the next row goes into edit mode on the UI, faster than the completion of the action chain populating currentRow with the next row’s data—causes the previous row's data to briefly display in the next row.

Async handling of these events can resolve this issue, by allowing VB Studio to provide a Promise that instructs the table to display a loading indicator while waiting for the Promise to resolve (or be rejected), until all action chains linked to the event have completed. Until then, the next row will not go into edit mode.

Caution:

Converting an existing event configured with non-async behavior may have unintended consequences when switched over to async behavior if the corresponding action chains are not reworked. It's important to review JET event documentation for components that supports async events (for example, the table component's ojBeforeRowEdit and ojBeforeRowEditEnd) to understand the implications of enabling async handling and to help implement your action chain logic suitably.

To enable async handling:

  1. Open the Event Listeners editor and select the event under Component Event Listeners, for example, tableBeforeRowEdit.
  2. In the event listener's Properties pane, toggle Async Handling from Disabled (default) to Enabled.