Databases Reference
In-Depth Information
270-274: Standard debugging code; you can instrument the rest of your
function with more debugging code but at a minimum including this debug
statement.
280-296: This code sets the background color and opacity for modal windows.
This is a page-level setting (i.e., will be the same for all the modal windows).
You could use htp.p to output the code; however, it would be run for each
instance of this plug-in. In the example, it would be run twice because there
aretwo instances of the same plug-in on the page. Since it needs to be run only
once, there's a parameter called p_key (line 295). If this key has already been
used, the code will not be reprinted. If the key is null, it will always be used.
300-302: Load JavaScript files.
304-329: This is a unique block of code. One of the custom attributes allows an
APEX developer to hide the affected region on page load. Since the dynamic
action code is run only when it is triggered, additional steps are required to find
the affected elements and explicitly hide them once the page is loaded.
On lines 316, 318, and 320, the JavaScript references the
apex.jQuery namespace rather than $. This ensures that it is actually referencing
the jQuery code rather than a different JavaScript library.
On line 328, p_key is set to NULL (default value). This means that the code will
always be run. Since NULL is the default value, you don't need to explicitly
reference it if you don't need it.
331-336: Defines the return object; the first thing you'll notice is that there's no
explicit call to actually “run” any JavaScript code to trigger your plug-in like an
item plug-in. Instead, all you need to do is define the JavaScript function name.
This function should not take in any parameters, as all the values that you need
are available in the dynamic action this object (discussed earlier in this
chapter).
Lines 333-336 set attributes that are available in the this.action JavaScript
object. These attributes are not the same as custom (application and
component) attributes. These attributes are passed as strings, so you should
ensure that you convert any non-string values to strings when setting them.
This is why the Y/N values ( v_modal and v_close_on_esc ) are converted to string
true/false values rather than Oracle Boolean values.
JavaScript
Similar to the previous section, this section will list the JavaScript code and then break down each
section. Before continuing, you'll need to download and copy $console_wrapper_1.0.3.js and
jquery.ui.clarifitDialog_1.0.0.js into c:\www\ApexDialog (or the appropriate web server directory) for
this plug-in to work. These files are available in the source code files that accompany this topic.Since the
previous chapter covered how to embed JavaScript files directly into your plug-in, this chapter will not
do so. You are encouraged to review the previous chapter (see the “Wrapping Up” section) and embed
the JavaScript files on your own.
 
Search WWH ::




Custom Search