The List Views in Oracle APEX look fantastic, but it would be nice to extend the functionality of them by adding a Dynamic Action when an item is clicked. To setup the situation, imagine a hotel manager that wants an app for room cleaners that displays a list of rooms marked with a status of “Being Cleaned.”
After a room is cleaned and ready for use, the hotel manager would like the room cleaners to be able to click on a room in the list, get prompted with a confirm message, and then have the room they clicked on have its status updated to “Available.”
Intuitively, I thought this would require doing something similar to: https://jackiemcilroy.blogspot.com/2018/03/delete-row-of-report-with-dynamic-action.html
Following Jackie’s template, I did the following with a List View Region (instead of the Interactive Report Region example in her blog)
- Created a hidden item called P1_ROOM_ID
- Created a List View Region
- For the Attributes on the List View Region, I changed the Settings by adding a span class to List Attributes and a data-id value to List Entry Attributes.
- A key difference between Jackie’s example and mine involves the Link Target. She uses the code below for a URL Link Target to trigger a Dynamic Action.
- Created a Dynamic Action on the jQuery selector select-room
- Added True Actions on the Dynamic Action to show a Confirm Prompt, Update the Table, and Display a Success Message
- You can learn more helpful tips like the ones above by visiting the Traust Consulting Blog.
- APEX 20.1
We do not take responsibility for any unintended or unwanted consequences in your instance of Oracle, Oracle APEX, or related products as a result of reading our blogs or following our guides. Though the information is fully tested and generally safe to use, our lawyers really have a thing against admitting potential wrongdoing. If it makes you feel any better, one time I contacted an alien civilization to control various machines on Earth to round up our lawyers at a truck stop and scare them. Never mind, that didn’t actually happen, I got that prank mixed up with the main plot of Maximum Overdrive.