Skip to main content

Update CLOB

The dynamic action updates draft CLOB in the plug-in session state through an AJAX request with the current value of page item. The action can be extended with optional JavaScript callbacks on success or failure. The action update CLOB may fail due to Oracle APEX session expired error, or due to unexpected PL/SQL error while processing AJAX request.

ideas

The dynamic action can be used to implement custom document handling, for example document versioning in the database table or Oracle APEX collection or saving a document in the database without submitting a page.

Live demo

The dynamic action Update CLOB can be tested in the plug-in online sample application here.

Action attributes

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

AttributeTypeDescription
ActionSelect listMust be set to Update CLOB

Initialization JavaScript Code

The dynamic action attribute Initialization JavaScript Code can be used to define JavaScript callbacks done and fail executed after updating draft-CLOB in the plug-in session state.

The anonymous function accepts empty JSON object {} named pOptions and returns object with two anonymous functions to be executed on success or failure of the action.

Callback functions accepts arguments as described below:

ParameterTypeDescription
pItemNameStringpage item that was updated using the action
pChecksumNumberCLOB checksum after updating in the plug-in session state as draft CLOB
pAjaxResultObjectJSON object containg standard AJAX failure arguments: jqXHR, textStatus, errorThrown

Syntax

function( pOptions ) {
pOptions.done = function( pItemName, pChecksum ){
// code to be executed when successfuly updated
};
pOptions.fail = function( pItemName, pAjaxResult ){
// code to be executed when unexpected error is raised, for example Session Expired
};

return pOptions;
}

Example

The example callbacks execute custom events updatesuccess or updatefailure with dynamic action data (this.data) depending on dynamic action result.

Initialization JavaScript Code (Dynamic Action)
function( pOptions ) {
pOptions.done = function( pItemName, pChecksum ){
apex.event.trigger(document, 'updatesuccess', {"item": pItemName, "checksum": pChecksum});
};

pOptions.fail = function( pItemName, pAjaxResult ){
apex.event.trigger(document, 'updatefailure', {"item": pItemName, "jqXHR": pAjaxResult.jqXHR});
};

return pOptions;
}

JavaScript Events

Once a page item value is updated in the plug-in session state, the plug-in triggers event UC Froala CLOB updated.