Skip to content

Initialization JavaScript Code

The dynamic action configures a page item using JavaScript options. The resulted options overrides a page item attribute Initialization JavaScript Code. A dynamic action can be created on same page, or on APEX global page.

A dynamic action attributes Authorization Scheme and Server-Side Condition can be used to apply the configuration according to user role in a application, or to application PL/SQL logic.

:::note Dynamic Action pre-requisites

The guidelines describing dynamic action configuration (dynamic action event, triggering element and affected elements) are described in parent document Configuration.

:::

The dynamic action attribute must define anonymous function returning JavaScript options configuring the plug-in. The anonymous function accepts only one parameter pOptions. The parameter is JSON object containing all options computed from a page item attribute Initialization JavaScript Code. The function must return modified options, otherwise, the plug-in raise an error.

Syntax

function( pOptions ) {
return pOptions;
}

Example

The example code below modifies image context menu.

function( pOptions ){
pOptions.imageEditButtons = [
'imageCaption', '|', 'imageSize', '-',
'imageAlign', '|', 'imageRemove'
];
return pOptions;
}

:::tip JavaScript options

The plug-in customization guidelines covers some of options that can be customized using this dynamic action. The full list of JavaScript options can be found in Froala API documentation.

:::