3 Replies Latest reply on Nov 23, 2012 10:53 AM by bookert

    Dynamic action on show region


      Application Express

      I have a report region on a page that is conditionaly displayed based on the value of a page item Pn_ITEM = 'HIDE'.

      I have dynamic actions that run on the page that populate a collection and refresh the report without the need to submit the page. However I need to somehow show the report when the collection has at least one member present.

      I have tried the following:

      1st true action executes pl/sql that adds a record / member to a collection, then a 2nd action sets the value to a page item Pn_ITEM = 'SHOW' and a 3rd true action that should show the region based on the set value from true action 2.

      My collection has a member added. The value 'SHOW' is applied to my page item Pn_ITEM by the dynamic action however the report region that I now want displayed is not showing. Obviously if the page is submitted the report will now be shown however I cannot submit the page at this point thats why I need to do this dynamicaly or through javascript and on demand processes.

      Any ideas how to get my report region to display once the collection has at least one member without submitting the page?

      Thanks in advance.
        • 1. Re: Dynamic action on show region
          Tom Petrus
          Remove the condition for display from the region. You don't want to have this here since it will completely stop the region from rendering if the condition is not fullfilled at rendering time. You want it rendered, just not displayed.

          Add css to the region (inline, class):
          style="display: none;"
          Add a true action which will do a refresh on your region (Component - Refresh, select your report region as an affected element).

          Now either:
          Add a true action of type execute javascript. Since you can't put conditions on true actions, we'll test the condition in javascript.
          Pick one:
          //if you want to target the region to be shown by an ID (static id?)
          //if the triggering element would be the region to be shown
          //if you'd want multiple affected elements to be shown at once drop the [0]
          Create a new dynamic action which has the same triggering conditions as your other dynamic action.
          Specify a when condition:
          Create one true action of the type 'Show' to show the region.

          End result should be your dynamic action creating an element in the collection, a refresh of the report based on the element (but still not shown), and finally a show of the region.

          Don't forget that the actions will also need fire on page load (so don't forget to check the checkbox on the true actions), otherwise the region will not be shown initially.
          I'd say that the item is probably not necessary anymore, but that depends on any other logic you might have on your page and possibly interacts with it.
          • 2. Re: Dynamic action on show region
            Hi Tom,

            Many thanks for your response. I have applied the logic but my region is still not displaying, can I confirm that the report region 'Region Attributes' should style="display: none;"
            • 3. Re: Dynamic action on show region
              Hi Tom,

              Its OK I have it working now. Thank you for your guidence.