Skip to main content

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 what Jackie McIlroy describes.

Following Jackie’s template, I did the following with a List View Region (instead of the Interactive Report Region example in her blog)

    1. Created a hidden item called P1_ROOM_ID
    2. Created a List View Region
    3. 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.

javascript:void(null);

      • With a List View, that same process won’t work, but APEX Developer Stefan Dobre had a much better suggestion to achieve the same result.  If we use the JavaScript URL below, we can get the Primary Key and set the value of our hidden item P1_ROOM_ID with that value.

javascript:$s('P1_ROOM_ID','&ID.');

 

    1. Created a Dynamic Action on the jQuery selector select-room

 

 

    1. Added True Actions on the Dynamic Action to show a Confirm Prompt, Update the Table, and Display a Success Message

 

 

 

 

[su_spacer size=”30″]

Requirements

  • APEX 20.1
[su_spacer size=”30″]

Disclaimer:
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.