Databases Reference
In-Depth Information
p min columns => 7,
p max columns => 7,
p component name => p region.name
);
Because the Ajax request will be returning JSON, the
PRINT JSON HTTP HEADER
procedure of the
APEX PLUGIN UTIL
package is used to output the correct HTTP header. Afterward, the start of a JSON
object is output and a loop to build up the contents of the object is started. Data returned from the query
is escaped via
SYS.HTF.ESCAPE SC
and then added to the object using
APEX JAVASCRIPT.ADD ATTRIBUTE
.
apex plugin util.print json http header;
sys.htp.p('[');
FOR x IN 1 .. l column value list(1).count
LOOP
l id := sys.htf.escape sc(l column value list(1)(x));
l title := sys.htf.escape sc(l column value list(2)(x));
l all day :=
CASE
WHEN UPPER(sys.htf.escape sc(l column value list(3)(x))) = 'TRUE'
THEN TRUE
ELSE FALSE
END;
l start := sys.htf.escape sc(l column value list(4)(x));
l end := sys.htf.escape sc(l column value list(5)(x));
l url := sys.htf.escape sc(l column value list(6)(x));
l class name := sys.htf.escape sc(l column value list(7)(x));
sys.htp.p(
CASE
WHEN x > 1 THEN ','
END
|| '{'
|| apex javascript.add attribute('id', l id, TRUE, TRUE)
|| apex javascript.add attribute('allDay', l all day, TRUE, TRUE)
|| apex javascript.add attribute('end', l end, TRUE, TRUE)
|| apex javascript.add attribute('url', l url, TRUE, TRUE)
|| apex javascript.add attribute('className', l class name, TRUE, TRUE)
|| apex javascript.add attribute('title', l title, FALSE, TRUE)
|| apex javascript.add attribute('start', l start, FALSE, FALSE)
|| '}'
);
END LOOP;
sys.htp.p(']');
RETURN l retval;
END calendar ajax;