Upload Images on demand
The dynamic action initilizes the plug-in upload and update workflow on the end-user request. Depending on the plug-in upload and update workflow result, the JavaScript callbacks done, cancel and fail are executed.
Live demo
Section titled “Live demo”Test the plug-in dynamic action upload images on demand in the plug-in sample application example page.
Action Attributes
Section titled “Action Attributes”:::note Pre-requisites
The guidelines describing dynamic action configuration (dynamic action event, triggering element and affected elements) are described in parent document Actions on demand.
:::
Settings
Section titled “Settings”| Attribute | Type | Description |
|---|---|---|
| Action | Select list | Must be set to Upload images |
Initialization JavaScript Code
Section titled “Initialization JavaScript Code”The dynamic action attribute Initialization JavaScript Code is used to define anonymouse function returning callbacks to be executed, once the plug-in upload and update workflow finishes processing images.
The JavaScript callbacks must be defined using the dynamic action standard attribute Initialization JavaScript Code. The anonymous function accepts only one argument: empty JSON object {}. The function must return JSON object with optional callback functions named start, done, cancel or fail.
Syntax
Section titled “Syntax”Callback functions accepts only one argument pItemName referencing a page item name implementing the plug-in.
function( pCallbaacks ){ pCallbaacks.start = function( pItemName ){}; pCallbaacks.done = function( pItemName ){}; pCallbaacks.cancel = function( pItemName ){}; pCallbaacks.fail = function( pItemName ){};
return pCallbaacks;}Example
Section titled “Example”The example code below triggers custom event:
uploadstartwhen the upload and update workflow starts processing a document,uploaddonewhen the upload and update workflow finishes processing a document,uploadcanceledwhen the workflow is canceled either by end-user or the plug-in,uploadfailwhen unexpected JavaScript or PL/SQL error is raised.
function( pCallbaacks ){ pCallbaacks.start = function( pItemName ){ apex.event.trigger(apex.item(pItemName).node, 'uploadstart'); };
pCallbaacks.done = function( pItemName ){ apex.event.trigger(apex.item(pItemName).node, 'uploaddone'); };
pCallbaacks.cancel = function( pItemName ){ apex.event.trigger(apex.item(pItemName).node, 'uploadcanceled'); };
pCallbaacks.fail = function( pItemName ){ apex.event.trigger(apex.item(pItemName).node, 'uploadfailed'); };
return pCallbaacks;}JavaScript Events
Section titled “JavaScript Events”So far, the action doesn’t trigger any dynamic action specific JavaScript events.