SlideShare a Scribd company logo
Developer Advocate @ Oracle
April 21, 2020
Dan McGhan
the Hard Parts
Dynamic Actions
Copyright © 2020, Oracle and/or its affiliates2
Copyright © 2020, Oracle and/or its affiliates3
Copyright © 2020, Oracle and/or its affiliates4
Need to learn the basics?
https://bit.ly/intro2js4apex https://bit.ly/js-con-apex
Copyright © 2020, Oracle and/or its affiliates5
3
2
1
Using and debugging Ajax
Leveraging JavaScript hooks
Understanding DOM events
What are the hard parts of Dynamic Actions?
Copyright © 2020, Oracle and/or its affiliates6
3
2
1
Using and debugging Ajax
Leveraging JavaScript hooks
Understanding DOM events
What are the hard parts of Dynamic Actions?
Copyright © 2020, Oracle and/or its affiliates7
• Hypertext Markup Language (HTML)
- Markup language that browsers understand to render web pages
• Document Object Model (DOM)
- In memory object representation of the HTML document (DOM tree)
- API for working with and manipulating the memory structure
HTML vs. DOM
Copyright © 2020, Oracle and/or its affiliates8
HTML document
http://www.html5rocks.com/en/tutorials/internals/howbrowserswork
Copyright © 2020, Oracle and/or its affiliates9
DOM Tree
http://www.html5rocks.com/en/tutorials/internals/howbrowserswork
Copyright © 2020, Oracle and/or its affiliates10
What happens if you click an element in the DOM?
http://www.html5rocks.com/en/tutorials/internals/howbrowserswork
Copyright © 2020, Oracle and/or its affiliates11
• Events are like triggers in the database
- Allow code to respond to user actions
• Browsers automatically trigger many events
• It’s possible to trigger custom events
- APEX makes use of this for framework and component events
What are events?
Copyright © 2020, Oracle and/or its affiliates12
• on() typically binds event handlers directly on objects
Event binding with on()
$('.report-button').on('click', function() {
console.log('direct binding');
});
Copyright © 2020, Oracle and/or its affiliates13
• on() typically binds event handlers directly on objects
Event binding with on()
$('.report-button').on('click', function() {
console.log('direct binding');
});
Document
Region container
Table
Row Button
Row Button
Copyright © 2020, Oracle and/or its affiliates14
• on() typically binds event handlers directly on objects
- Bindings are lost when elements are replaced
Event binding with on()
$('.report-button').on('click', function() {
console.log('direct binding');
});
Document
Region container
Table
Row Button
Row Button
Copyright © 2020, Oracle and/or its affiliates15
• on() typically binds event handlers directly on objects
- Bindings are lost when elements are replaced
Event binding with on()
$('.report-button').on('click', function() {
console.log('direct binding');
});
Document
Region container
Table
Row Button
Row Button
Document
Region container
Table
Row Button
Row Button
Copyright © 2020, Oracle and/or its affiliates16
Event dispatching and DOM event flow
https://www.w3.org/TR/DOM-Level-3-Events/#event-flow
Copyright © 2020, Oracle and/or its affiliates17
• on() typically binds event handlers directly on objects
- Bindings are lost when elements are replaced
Event binding with on()
$('.report-button').on('click', function() {
console.log('direct binding');
});
Document
Region container
Table
Row Button
Row Button
Document
Region container
Table
Row Button
Row Button
Copyright © 2020, Oracle and/or its affiliates18
• on() accepts an optional selector for event delegation
- More efficient than many individual bindings; works if elements replaced
Event delegation with on()
$('.report-button').on('click', function() {
console.log('direct binding');
});
$('#report').on('click', '.report-button', function() {
console.log('delegated binding');
});
Document
Region container
Table
Row Button
Row Button
Copyright © 2020, Oracle and/or its affiliates19
• Dynamic Actions support event delegation too
• Look under the Dynamic Action’s Advanced settings
- Set Event Scope to Dynamic
- Static Container is optional (defaults to the document)
Event delegation with Dynamic Actions
Action
Dynamic Action
Copyright © 2020, Oracle and/or its affiliates20
3
2
1
Using and debugging Ajax
Leveraging JavaScript hooks
Understanding DOM events
What are the hard parts of Dynamic Actions?
Copyright © 2020, Oracle and/or its affiliates21
• Dynamic Actions can’t cover everything
• JavaScript hooks provide extended declarative capabilities
- Requires basic knowledge of JavaScript and jQuery to use
Learn to use the JavaScript hooks
Copyright © 2020, Oracle and/or its affiliates22
• Dynamic Actions can’t cover everything
• JavaScript hooks provide extended declarative capabilities
- Requires basic knowledge of JavaScript and jQuery to use
Learn to use the JavaScript hooks
Action
Dynamic Action
When
+
Client-side Condition
Identification
+
Affected Elements
Copyright © 2020, Oracle and/or its affiliates23
• Most common Event values
When > Event: Typical configuration
Action
Dynamic Action
Click Change
Page Load
Copyright © 2020, Oracle and/or its affiliates24
• Most common Event values
When > Event: Typical configuration
Action
Dynamic Action
Click Change
Page Load
What if the event you
need isn’t listed?
Copyright © 2020, Oracle and/or its affiliates25
• Set Event to Custom
- Exposes Custom Event
• Use Custom Event to
- Specify events not in the declarative list
- Bind to multiple events (space delimited)
When > Event: JavaScript hooks
Action
Dynamic Action
ButtonItem(s)
Copyright © 2020, Oracle and/or its affiliates26
• Most common Selection Type values
When > Selection Type: Typical configuration
Action
Dynamic Action
ButtonItem(s)
Copyright © 2020, Oracle and/or its affiliates27
• Most common Selection Type values
When > Selection Type: Typical configuration
Action
Dynamic Action
What if you want to select
something other than a
typical APEX component?
Copyright © 2020, Oracle and/or its affiliates28
• Set Selection Type to jQuery Selector
- Exposes jQuery Selector
• Use jQuery Selector to
- Select elements not in the declarative list
- Can select multiple elements
When > Selection Type: JavaScript hooks
Action
Dynamic Action
Copyright © 2020, Oracle and/or its affiliates29
• Set Selection Type to JavaScript Expression
- Exposes JavaScript Expression
• Use JavaScript Expression to
- Select elements not in the declarative list
- Can select multiple elements
When > Selection Type: JavaScript hooks
Action
Dynamic Action
Copyright © 2020, Oracle and/or its affiliates30
• Set Selection Type to JavaScript Expression
- Exposes JavaScript Expression
• Use JavaScript Expression to
- Select elements not in the declarative list
- Can select multiple elements
When > Selection Type: JavaScript hooks
Action
Dynamic Action
See the help for
useful info.
Copyright © 2020, Oracle and/or its affiliates31
• Set Selection Type to JavaScript Expression
- Exposes JavaScript Expression
• Use JavaScript Expression to
- Select elements not in the declarative list
- Can select multiple elements
When > Selection Type: JavaScript hooks
Action
Dynamic Action
Copyright © 2020, Oracle and/or its affiliates32
• Set Selection Type to JavaScript Expression
- Exposes JavaScript Expression
• Use JavaScript Expression to
- Select elements not in the declarative list
- Can select multiple elements
When > Selection Type: JavaScript hooks
Action
Dynamic Action
Copyright © 2020, Oracle and/or its affiliates33
• Most common Type values
Client-side Condition > Type: Typical configuration
Action
Dynamic Action
Item = Value Item != Value
Item is null Item is not null
Copyright © 2020, Oracle and/or its affiliates34
• Most common Type values
Client-side Condition > Type: Typical configuration
Action
Dynamic Action
Item = Value Item != Value
Item is null Item is not null
What if your condition is more
complex than checking the
value of a single item?
Copyright © 2020, Oracle and/or its affiliates35
• Set Type to JavaScript expression
- Exposes JavaScript Expression
• Use JavaScript expression to
- Work with any elements in the DOM
- Implement compound conditions
Client-side Condition > Type: JavaScript hooks
Action
Dynamic Action
Copyright © 2020, Oracle and/or its affiliates36
• Set Type to JavaScript expression
- Exposes JavaScript Expression
• Use JavaScript expression to
- Work with any elements in the DOM
- Implement compound conditions
Client-side Condition > Type: JavaScript hooks
Action
Dynamic Action
Can even be an IIFE!
🤪
Copyright © 2020, Oracle and/or its affiliates37
• Set Type to JavaScript expression
- Exposes JavaScript Expression
• Use JavaScript expression to
- Work with any elements in the DOM
- Implement compound conditions
Client-side Condition > Type: JavaScript hooks
Action
Dynamic Action
Or a global function call.
😐
Copyright © 2020, Oracle and/or its affiliates38
• Declarative options are great for common interactions
- Hide/show, enable/disable, refresh, etc.
• Execute JavaScript can do anything not available out of the box
Action: Execute JavaScript
Action
Dynamic Action
Copyright © 2020, Oracle and/or its affiliates39
3
2
1
Using and debugging Ajax
Leveraging JavaScript hooks
Understanding DOM events
What are the hard parts of Dynamic Actions?
Copyright © 2020, Oracle and/or its affiliates40
• Short for Asynchronous JavaScript and XML
- Sometimes it’s not asynchronous and these days JSON is more popular
• It’s a technique to communicate with the server without a full-page refresh
What is Ajax?
Web Browser Web Server Database
HTTP GET Data
HTML fragment/JSON data
JS
Code
Copyright © 2020, Oracle and/or its affiliates41
• Just like regular Ajax, only easier
- Oracle Database does the server-side processing
- Dynamic Actions can handle many use cases
- Programmatic options are provided for edge cases
• Must send correct data in to get correct data out
Ajax in APEX
Copyright © 2020, Oracle and/or its affiliates42
• Three out-of-the-box actions do Ajax
- Refresh
- Set Value
- Execute PL/SQL
• Each provides a means of sending data to the server
- Look for “Items to Submit”
Ajax with Dynamic Actions
Copyright © 2020, Oracle and/or its affiliates43
• Used to refresh several components
- Regions: Classic Report, Interactive Report, and Interactive Grid
- Items: those with Cascading LOV support
• Don’t forget to send in the correct data
- Page Items to Submit is part of the region definition
- Not necessary for items
Refresh
Copyright © 2020, Oracle and/or its affiliates44
• Used to set the value of an item/element
• SQL and PL/SQL options do implicit Ajax
- SQL Statement, PL/SQL Expression, PL/SQL Function Body
• Don’t forget to send in the correct data
- Items to Submit is in the action under the SQL or PL/SQL code
Set Value
Copyright © 2020, Oracle and/or its affiliates45
• Like Set Value but a bit more generic
• Has Wait For Result option to control flow through subsequent actions
• Don’t forget to send and retrieve in the correct data
- Items to Submit and Items to Return are in the action under the SQL or PL/SQL code
Execute PL/SQL
Copyright © 2020, Oracle and/or its affiliates46
• Look for the data being sent to the server
Debug using the Network tab of your Developer Tools
Copyright © 2020, Oracle and/or its affiliates47
Live Demo
Copyright © 2020, Oracle and/or its affiliates48
Ready to learn more?
https://bit.ly/intro2js4apex https://bit.ly/js-con-apex
Follow me on Twitter
twitter.com/dmcghan
Dynamic Actions, the Hard Parts

More Related Content

PDF
Module 1: JavaScript Basics
PDF
Introduction to JavaScript for APEX Developers - Module 2: Adding JavaScript ...
PDF
Intro to JavaScript for APEX Developers
PDF
Module 2: Adding JavaScript to APEX Apps
PDF
Introduction to JavaScript for APEX Developers - Module 1: JavaScript Basics
PPTX
Intro to GraphQL for Database Developers
PPTX
JavaScript: Why Should I Care?
PDF
Module 3: Working with the DOM and jQuery
Module 1: JavaScript Basics
Introduction to JavaScript for APEX Developers - Module 2: Adding JavaScript ...
Intro to JavaScript for APEX Developers
Module 2: Adding JavaScript to APEX Apps
Introduction to JavaScript for APEX Developers - Module 1: JavaScript Basics
Intro to GraphQL for Database Developers
JavaScript: Why Should I Care?
Module 3: Working with the DOM and jQuery

What's hot (20)

PDF
JSON and Oracle Database: A Brave New World
PDF
Oracle APEX 18.1 New Features
PDF
Oracle APEX, Oracle Autonomous Database, Always Free Oracle Cloud Services
PDF
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
PDF
UNYOUG - APEX 19.2 New Features
PPT
JSF (ADF) Case Studies Presentation
PPTX
Oracle APEX Introduction (release 18.1)
PDF
Oracle APEX 18.1 New Features
PDF
Oracle Application Express 20.2 New Features
PDF
NYC School of Data - High School Selection Workshop
PDF
Introduction to React Native
PPTX
PPTX
Oracle apex training
PDF
APEX Boston Meetup - October 1st, 2019
PDF
Oracle APEX Social Login
PDF
APEX Alpe Adria Mike Hichwa Keynote April 11th 2019- Zagreb
PPTX
Angular interview questions
PDF
The 7 Deadly Sins of API Design
PPT
Oracle Application Express
PPT
Web Development In Oracle APEX
JSON and Oracle Database: A Brave New World
Oracle APEX 18.1 New Features
Oracle APEX, Oracle Autonomous Database, Always Free Oracle Cloud Services
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
UNYOUG - APEX 19.2 New Features
JSF (ADF) Case Studies Presentation
Oracle APEX Introduction (release 18.1)
Oracle APEX 18.1 New Features
Oracle Application Express 20.2 New Features
NYC School of Data - High School Selection Workshop
Introduction to React Native
Oracle apex training
APEX Boston Meetup - October 1st, 2019
Oracle APEX Social Login
APEX Alpe Adria Mike Hichwa Keynote April 11th 2019- Zagreb
Angular interview questions
The 7 Deadly Sins of API Design
Oracle Application Express
Web Development In Oracle APEX
Ad

Similar to Dynamic Actions, the Hard Parts (20)

PDF
Practical Dynamic Actions - Intro
PDF
My Top 5 APEX JavaScript API's
PPTX
J Query The Write Less Do More Javascript Library
PPTX
Web Development Introduction to jQuery
PPTX
APEX Office Hours Interactive Grid Deep Dive
PPT
Ajax Fundamentals Web Applications
PDF
Utilising the data attribute
PPTX
JSON and XML
PDF
Javascript libraries
PDF
Done in 60 seconds - Creating Web 2.0 applications made easy
PDF
1 ppt-ajax with-j_query
PPTX
Ajax and Jquery
PPTX
Jquery Basics
PDF
Sewtz apex ui
PPTX
J Query Presentation of David
PDF
PPTX
Asynchronous javascript and xml
PPT
JavaScript JQUERY AJAX
PPT
Practical Dynamic Actions - Intro
My Top 5 APEX JavaScript API's
J Query The Write Less Do More Javascript Library
Web Development Introduction to jQuery
APEX Office Hours Interactive Grid Deep Dive
Ajax Fundamentals Web Applications
Utilising the data attribute
JSON and XML
Javascript libraries
Done in 60 seconds - Creating Web 2.0 applications made easy
1 ppt-ajax with-j_query
Ajax and Jquery
Jquery Basics
Sewtz apex ui
J Query Presentation of David
Asynchronous javascript and xml
JavaScript JQUERY AJAX
Ad

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Cloud computing and distributed systems.
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Chapter 3 Spatial Domain Image Processing.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
A Presentation on Artificial Intelligence
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Mobile App Security Testing_ A Comprehensive Guide.pdf
Network Security Unit 5.pdf for BCA BBA.
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
20250228 LYD VKU AI Blended-Learning.pptx
Unlocking AI with Model Context Protocol (MCP)
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Diabetes mellitus diagnosis method based random forest with bat algorithm
Dropbox Q2 2025 Financial Results & Investor Presentation
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Per capita expenditure prediction using model stacking based on satellite ima...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Cloud computing and distributed systems.
NewMind AI Weekly Chronicles - August'25 Week I
Understanding_Digital_Forensics_Presentation.pptx

Dynamic Actions, the Hard Parts

  • 1. Developer Advocate @ Oracle April 21, 2020 Dan McGhan the Hard Parts Dynamic Actions
  • 2. Copyright © 2020, Oracle and/or its affiliates2
  • 3. Copyright © 2020, Oracle and/or its affiliates3
  • 4. Copyright © 2020, Oracle and/or its affiliates4 Need to learn the basics? https://bit.ly/intro2js4apex https://bit.ly/js-con-apex
  • 5. Copyright © 2020, Oracle and/or its affiliates5 3 2 1 Using and debugging Ajax Leveraging JavaScript hooks Understanding DOM events What are the hard parts of Dynamic Actions?
  • 6. Copyright © 2020, Oracle and/or its affiliates6 3 2 1 Using and debugging Ajax Leveraging JavaScript hooks Understanding DOM events What are the hard parts of Dynamic Actions?
  • 7. Copyright © 2020, Oracle and/or its affiliates7 • Hypertext Markup Language (HTML) - Markup language that browsers understand to render web pages • Document Object Model (DOM) - In memory object representation of the HTML document (DOM tree) - API for working with and manipulating the memory structure HTML vs. DOM
  • 8. Copyright © 2020, Oracle and/or its affiliates8 HTML document http://www.html5rocks.com/en/tutorials/internals/howbrowserswork
  • 9. Copyright © 2020, Oracle and/or its affiliates9 DOM Tree http://www.html5rocks.com/en/tutorials/internals/howbrowserswork
  • 10. Copyright © 2020, Oracle and/or its affiliates10 What happens if you click an element in the DOM? http://www.html5rocks.com/en/tutorials/internals/howbrowserswork
  • 11. Copyright © 2020, Oracle and/or its affiliates11 • Events are like triggers in the database - Allow code to respond to user actions • Browsers automatically trigger many events • It’s possible to trigger custom events - APEX makes use of this for framework and component events What are events?
  • 12. Copyright © 2020, Oracle and/or its affiliates12 • on() typically binds event handlers directly on objects Event binding with on() $('.report-button').on('click', function() { console.log('direct binding'); });
  • 13. Copyright © 2020, Oracle and/or its affiliates13 • on() typically binds event handlers directly on objects Event binding with on() $('.report-button').on('click', function() { console.log('direct binding'); }); Document Region container Table Row Button Row Button
  • 14. Copyright © 2020, Oracle and/or its affiliates14 • on() typically binds event handlers directly on objects - Bindings are lost when elements are replaced Event binding with on() $('.report-button').on('click', function() { console.log('direct binding'); }); Document Region container Table Row Button Row Button
  • 15. Copyright © 2020, Oracle and/or its affiliates15 • on() typically binds event handlers directly on objects - Bindings are lost when elements are replaced Event binding with on() $('.report-button').on('click', function() { console.log('direct binding'); }); Document Region container Table Row Button Row Button Document Region container Table Row Button Row Button
  • 16. Copyright © 2020, Oracle and/or its affiliates16 Event dispatching and DOM event flow https://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  • 17. Copyright © 2020, Oracle and/or its affiliates17 • on() typically binds event handlers directly on objects - Bindings are lost when elements are replaced Event binding with on() $('.report-button').on('click', function() { console.log('direct binding'); }); Document Region container Table Row Button Row Button Document Region container Table Row Button Row Button
  • 18. Copyright © 2020, Oracle and/or its affiliates18 • on() accepts an optional selector for event delegation - More efficient than many individual bindings; works if elements replaced Event delegation with on() $('.report-button').on('click', function() { console.log('direct binding'); }); $('#report').on('click', '.report-button', function() { console.log('delegated binding'); }); Document Region container Table Row Button Row Button
  • 19. Copyright © 2020, Oracle and/or its affiliates19 • Dynamic Actions support event delegation too • Look under the Dynamic Action’s Advanced settings - Set Event Scope to Dynamic - Static Container is optional (defaults to the document) Event delegation with Dynamic Actions Action Dynamic Action
  • 20. Copyright © 2020, Oracle and/or its affiliates20 3 2 1 Using and debugging Ajax Leveraging JavaScript hooks Understanding DOM events What are the hard parts of Dynamic Actions?
  • 21. Copyright © 2020, Oracle and/or its affiliates21 • Dynamic Actions can’t cover everything • JavaScript hooks provide extended declarative capabilities - Requires basic knowledge of JavaScript and jQuery to use Learn to use the JavaScript hooks
  • 22. Copyright © 2020, Oracle and/or its affiliates22 • Dynamic Actions can’t cover everything • JavaScript hooks provide extended declarative capabilities - Requires basic knowledge of JavaScript and jQuery to use Learn to use the JavaScript hooks Action Dynamic Action When + Client-side Condition Identification + Affected Elements
  • 23. Copyright © 2020, Oracle and/or its affiliates23 • Most common Event values When > Event: Typical configuration Action Dynamic Action Click Change Page Load
  • 24. Copyright © 2020, Oracle and/or its affiliates24 • Most common Event values When > Event: Typical configuration Action Dynamic Action Click Change Page Load What if the event you need isn’t listed?
  • 25. Copyright © 2020, Oracle and/or its affiliates25 • Set Event to Custom - Exposes Custom Event • Use Custom Event to - Specify events not in the declarative list - Bind to multiple events (space delimited) When > Event: JavaScript hooks Action Dynamic Action
  • 26. ButtonItem(s) Copyright © 2020, Oracle and/or its affiliates26 • Most common Selection Type values When > Selection Type: Typical configuration Action Dynamic Action
  • 27. ButtonItem(s) Copyright © 2020, Oracle and/or its affiliates27 • Most common Selection Type values When > Selection Type: Typical configuration Action Dynamic Action What if you want to select something other than a typical APEX component?
  • 28. Copyright © 2020, Oracle and/or its affiliates28 • Set Selection Type to jQuery Selector - Exposes jQuery Selector • Use jQuery Selector to - Select elements not in the declarative list - Can select multiple elements When > Selection Type: JavaScript hooks Action Dynamic Action
  • 29. Copyright © 2020, Oracle and/or its affiliates29 • Set Selection Type to JavaScript Expression - Exposes JavaScript Expression • Use JavaScript Expression to - Select elements not in the declarative list - Can select multiple elements When > Selection Type: JavaScript hooks Action Dynamic Action
  • 30. Copyright © 2020, Oracle and/or its affiliates30 • Set Selection Type to JavaScript Expression - Exposes JavaScript Expression • Use JavaScript Expression to - Select elements not in the declarative list - Can select multiple elements When > Selection Type: JavaScript hooks Action Dynamic Action See the help for useful info.
  • 31. Copyright © 2020, Oracle and/or its affiliates31 • Set Selection Type to JavaScript Expression - Exposes JavaScript Expression • Use JavaScript Expression to - Select elements not in the declarative list - Can select multiple elements When > Selection Type: JavaScript hooks Action Dynamic Action
  • 32. Copyright © 2020, Oracle and/or its affiliates32 • Set Selection Type to JavaScript Expression - Exposes JavaScript Expression • Use JavaScript Expression to - Select elements not in the declarative list - Can select multiple elements When > Selection Type: JavaScript hooks Action Dynamic Action
  • 33. Copyright © 2020, Oracle and/or its affiliates33 • Most common Type values Client-side Condition > Type: Typical configuration Action Dynamic Action Item = Value Item != Value Item is null Item is not null
  • 34. Copyright © 2020, Oracle and/or its affiliates34 • Most common Type values Client-side Condition > Type: Typical configuration Action Dynamic Action Item = Value Item != Value Item is null Item is not null What if your condition is more complex than checking the value of a single item?
  • 35. Copyright © 2020, Oracle and/or its affiliates35 • Set Type to JavaScript expression - Exposes JavaScript Expression • Use JavaScript expression to - Work with any elements in the DOM - Implement compound conditions Client-side Condition > Type: JavaScript hooks Action Dynamic Action
  • 36. Copyright © 2020, Oracle and/or its affiliates36 • Set Type to JavaScript expression - Exposes JavaScript Expression • Use JavaScript expression to - Work with any elements in the DOM - Implement compound conditions Client-side Condition > Type: JavaScript hooks Action Dynamic Action Can even be an IIFE! 🤪
  • 37. Copyright © 2020, Oracle and/or its affiliates37 • Set Type to JavaScript expression - Exposes JavaScript Expression • Use JavaScript expression to - Work with any elements in the DOM - Implement compound conditions Client-side Condition > Type: JavaScript hooks Action Dynamic Action Or a global function call. 😐
  • 38. Copyright © 2020, Oracle and/or its affiliates38 • Declarative options are great for common interactions - Hide/show, enable/disable, refresh, etc. • Execute JavaScript can do anything not available out of the box Action: Execute JavaScript Action Dynamic Action
  • 39. Copyright © 2020, Oracle and/or its affiliates39 3 2 1 Using and debugging Ajax Leveraging JavaScript hooks Understanding DOM events What are the hard parts of Dynamic Actions?
  • 40. Copyright © 2020, Oracle and/or its affiliates40 • Short for Asynchronous JavaScript and XML - Sometimes it’s not asynchronous and these days JSON is more popular • It’s a technique to communicate with the server without a full-page refresh What is Ajax? Web Browser Web Server Database HTTP GET Data HTML fragment/JSON data JS Code
  • 41. Copyright © 2020, Oracle and/or its affiliates41 • Just like regular Ajax, only easier - Oracle Database does the server-side processing - Dynamic Actions can handle many use cases - Programmatic options are provided for edge cases • Must send correct data in to get correct data out Ajax in APEX
  • 42. Copyright © 2020, Oracle and/or its affiliates42 • Three out-of-the-box actions do Ajax - Refresh - Set Value - Execute PL/SQL • Each provides a means of sending data to the server - Look for “Items to Submit” Ajax with Dynamic Actions
  • 43. Copyright © 2020, Oracle and/or its affiliates43 • Used to refresh several components - Regions: Classic Report, Interactive Report, and Interactive Grid - Items: those with Cascading LOV support • Don’t forget to send in the correct data - Page Items to Submit is part of the region definition - Not necessary for items Refresh
  • 44. Copyright © 2020, Oracle and/or its affiliates44 • Used to set the value of an item/element • SQL and PL/SQL options do implicit Ajax - SQL Statement, PL/SQL Expression, PL/SQL Function Body • Don’t forget to send in the correct data - Items to Submit is in the action under the SQL or PL/SQL code Set Value
  • 45. Copyright © 2020, Oracle and/or its affiliates45 • Like Set Value but a bit more generic • Has Wait For Result option to control flow through subsequent actions • Don’t forget to send and retrieve in the correct data - Items to Submit and Items to Return are in the action under the SQL or PL/SQL code Execute PL/SQL
  • 46. Copyright © 2020, Oracle and/or its affiliates46 • Look for the data being sent to the server Debug using the Network tab of your Developer Tools
  • 47. Copyright © 2020, Oracle and/or its affiliates47 Live Demo
  • 48. Copyright © 2020, Oracle and/or its affiliates48 Ready to learn more? https://bit.ly/intro2js4apex https://bit.ly/js-con-apex Follow me on Twitter twitter.com/dmcghan