Databases Reference
In-Depth Information
There is one result type defined for each of the callback functions a given plug-in type can use. The
example shows part of the render function of an item plug-in, which uses the corresponding
T PAGE ITEM RENDER RESULT record type as the result type. These result types allow developers to pass
information back to the plug-in framework such as whether a plug-in is navigable.
In addition to the record types, there are two functions defined in the APEX PLUGIN package as well:
GET INPUT NAME FOR PAGE ITEM and GET AJAX IDENTIFIER . The GET INPUT NAME FOR PAGE ITEM function is
only used for item plug-ins. It returns the value plug-in developers should assign to the name attribute of
the element that contains the correct value for the plug-in. APEX uses the name attribute of elements to
map an element's value on the page to the corresponding item's session state when a page is submitted.
Here is an example from an item render function that demonstrates its use (see the item plug-in in the
tutorials section for a complete example):
sys.htp.p(
'<input type="password" name="'
|| apex plugin.get input name for page item(p is multi value => FALSE)
|| '" id="' || p item.name ||
'" size="' || p item.element width || '" maxlength="'
|| p item.element max length
'" ' || p item.element attributes || '/>');
If you plan to take advantage of Ajax technology in your plug-in, you'll need a means to call the Ajax
callback function from JavaScript. To get around various issues related to calling the function by name,
the plug-in architecture requires you to call the function via a unique ID which is obtained from the
GET AJAX IDENTIFIER function.
The function will only work in the context of the render function and only if an AJAX callback
function has been defined. The result of the function call needs to be mapped through to the plug-in's
JavaScript code so that it can be used when needed. Here is an example from a region render function
that demonstrates how the function is used (see the region plug-in in the tutorials section for a complete
example):
l onload code :=
'apex.jQuery("div#' || p region.static id || '").calendar({'
|| apex javascript.add attribute(
p name => 'ajaxIdentifier',
p value => apex plugin.get ajax identifier(),
p omit null => FALSE,
p add comma => FALSE)
|| '});';
apex javascript.add onload code (
p code => l onload code
);
APEX_PLUGIN_UTIL
APEX PLUGIN UTIL is a utility package that eases the burden of developing plug-ins by providing
production-ready code for many common plug-in related tasks. The package has many functions and
procedures related to debugging, SQL and PL/SQL processing, and more.
Depending on their scope and complexity, debugging plug-ins can be a difficult task. Thankfully,
the APEX PLUGIN UTIL package comes with a number of debug procedures—at least one for each plug-in
Search WWH ::




Custom Search