Databases Reference
In-Depth Information
With the render function complete, the Ajax function can be added. Note that the signature of the
render function matches what is expected for a region Ajax function.
FUNCTION calendar ajax (
p region IN APEX PLUGIN.T REGION,
p plugin IN APEX PLUGIN.T PLUGIN
)
RETURN APEX PLUGIN.T REGION AJAX RESULT
Local variables are then declared. Some of the local variables are used simply to provide a better
name for the attribute values that are passed into the function.
IS
l retval APEX PLUGIN.T REGION AJAX RESULT;
l column value list APEX PLUGIN UTIL.T COLUMN VALUE LIST;
l start date item VARCHAR2(32767) := p region.attribute 01;
l end date item VARCHAR2(32767) := p region.attribute 02;
l window start DATE;
l window end DATE;
l id PLS INTEGER;
l title VARCHAR2(32767);
l all day BOOLEAN;
l start VARCHAR2(50);
l end VARCHAR2(50);
l url VARCHAR2(32767);
l class name VARCHAR2(100);
In the first part of the execution section, the values of the start and end date items are checked. If the
user supplied values for these then their session state values are set from g x01 and g x02 . The values for
the global variables come from the FullCalendar API and are passed through via the Ajax request.
BEGIN
IF l start date item IS NOT NULL
THEN
l window start := TO DATE(apex application.g x01, 'YYYYMMDD');
apex util.set session state(l start date item, l window start);
END IF;
IF l end date item IS NOT NULL
THEN
l window end := TO DATE(apex application.g x02, 'YYYYMMDD');
apex util.set session state(l end date item, l window end);
END IF;
APEX PLUGIN UTIL.GET DATA is used to execute the query that was supplied by the plug-in user as the
source for the region. The result set is returned to a local variable which will be processed later.
l column value list := apex plugin util.get data(
p sql statement => p region.source,
Search WWH ::




Custom Search