What are plug-ins & How to create plug-ins in Oracle APEX?

 

 

What are plug-ins?


A plug-in is nothing but an extension to the built-in types available in APEX. The types of plug-ins in the oracle APEX are authentication scheme, authorization scheme, item, region, dynamic action, and process types. 
A Developer can create or download & import a plug-in developed and publish by a developer on apex-world. A developer can create plug-in from scratch or as copy of an existing plug-in. 

How to create plug-ins in Oracle APEX?

here is an example of creating a simple APEX plugin that adds a button to a page and redirects to the previous page when the button is clicked:

  •       JS File :

 
               
                                IMAGE-01

  1. Create a js file with name "historyback.js" with code in IMAGE-01.
  2. Redirect to Shared Components > Files and Reports > Static Application Files.
  3. Click on create file & drag and drop "historyback.js".
  4. Then click on "Create".

  •       Plug-in :

  1. Create a new plugin in the APEX builder by going to Shared Components > Other Components > Plug-ins.
  2. Enter name, for example, "Back".
  3. Enter "Internal Name".
  4. Select Type as "Dynamic Action".
  5. Select Category as "Navigation".
  6. Add below code in PL/SQL source code from IMAGE-02.
IMAGE-02

          6. Add PL/SQL function/procedure name in Render Procedure/Function Name.

7. Select the affecting Item by selecting  one of the attributes from "

           8. Mention plugin version in Information > Version.

            9. Click on "Create Plug-in"


  • Code :-
    • JS code :- 
function historyback()
{
 window.history.back()
}

    • Pl/SQL code :- 
function history_back (
    p_dynamic_action in apex_plugin.t_dynamic_action,
    p_plugin         in apex_plugin.t_plugin )
    return apex_plugin.t_dynamic_action_render_result
is
    l_result apex_plugin.t_dynamic_action_render_result;
begin
    -- Add the .js file 
    apex_javascript.add_library (
        p_name      => 'historyback', -- Name of the Javascript file without .js extension
        p_directory => '#APP_IMAGES#', -- Path where this file is uploaded, in this case its inside Apex application directory
        p_version   => null );
    -- Assign the function to be used   
    l_result.javascript_function := 'historyback'; -- Javascript function name present inside your file to be used here
    return l_result;
end history_back;

     To summarize plug-ins are great way of reusing your object and share it with the community on apex-world 

Comments