Oracle Application Express (APEX) is shipped with several JavaScript libraries, jQuery being the best known one of them. And on top of these libraries the APEX Development Team created their own. You probably used a couple of these API's already, like $s, $v etc.
But there are way more and some of them are extremely useful. But first you have to be aware they exists. And secondly you have to know how to use the properly.
This session will cover the most valuable JavaScript API's with some real world examples.
Most developers stick to the standard $s and $v functions - even without knowing there is also a $v2 and $s can have more parameters.
The focus will be on the namespaced apex API's, like apex.server.process and apex.event.trigger.
20. $v
• Don’t use # for ID, just the ID itself - or a DOM node
$v(“#P4_FIELD”)
$v(“P4_FIELD”)
$(“P4_FIELD”).val()
$(“#P4_FIELD").val()
$v($(“input[name=p_t01]"))
$v($("input[name=p_t01]")[0])
20
21. $v2
• Same as $v for single value items
• Checkbox, Shuttle, Multi Select
• $v(“P4_CHECKBOX”)
• $v2(“P4_CHECKBOX”)
• Count selected items
21
22. $s
• Sets an item value
• $s(“P4_FIELD”,”ABCDE”)
• $s(“P4_CHECKBOX","10:30")
• $s(“P4_CHECKBOX”,[“20","40"])
• Click on report row to set ID
• For current record (http://roelhartman.blogspot.nl/2015/09/implementing-current-record-indicator.html)
• For master / detail sync
22
28. find() / children()
• Looks “down” in the DOM
• One level vs. all levels
• Get me a list of all Salary data in the #emp report:
28
29. closest() / parent() / parents()
• Look “up” in the DOM
• One level / First found / All levels
• “Highlight Current Record”:
• After Refresh of :
$(".rowlink").closest("div.t-Region, div.t-IRR-region”)
• Set the class of the current TR
$(“.rowlink”).closest(“tr”).addClass(“clickable”);
29
30. each()
• Execute a function for each matched element
• Example : Highlight all high salaries
30
35. apex.event.trigger
• Start a Dynamic Action using standard events
apex.event.trigger(“#emp”, “apexrefresh”)
apex.event.trigger(window, “apexwindowresized”)
• or … create your custom event
apex.event.trigger(“#emp”, “fireSalesmen”)
35