5 Replies Latest reply: Aug 23, 2013 1:04 PM by Jaydarp-Oracle RSS

    Dynamic action to refresh region -> show message to user

    Jaydarp-Oracle

      Hi,

       

           I have a page in apex 4.2.2.

           In this page I have a interactive report, and a fixed filter, users can choose.

           When users choose one of the filters, I set up a dynamic action to refresh the interactive report region, so it would refresh the data being shown without submitting.

           So far so good... but... when the region is refreshing there is "circle load" item that displays and lets the user know there is work being done in the page. But this icon is not so obvious.

           What I want is to add a message, for example to show a region, that would display a message like "The report is being refreshed, please wait" (something like that).

           I have tried to, insert in my dynamic action, as 1st action, to SHOW this region, and as the last action to HIDE it. But, to no avail, the region is never shown.

           How can I perform this task? All I need is to be able to show a message, for the duration of the dynamic action, to let know the user that s/he has to wait for the task to be completed.

           All current true actions have been flagged to "wait for result", if I did not understand this wrong, it means that it waits for previous true action to be completed, in order to trigger next one... This should show the region, and then hide it, but it does not.

           Anyone can help me with this? Perhaps provide an idea?

           Regards.

        • 1. Re: Dynamic action to refresh region -> show message to user
          Fred-L

          Hi,

           

          Edit the page parameters, in "Execute when page loads" add this code

          $("#apexir_LOADER").append('<div style="position: fixed; left: 50%; top: 50%; background-color: rgb(221, 221, 221); border-style: solid; border-width: 2px; border-color: rgb(119, 119, 119); padding: 5px;">The report is being refreshed, please wait</div>');
          
          
          
          


          This jQuery will just add a DIV centered on your page to the SPAN element used to display the refresh icon.

           

          I just tested it using Apex 4.2.1, I hope it will work too for you!

           

          Fred

           

          Edit reason: Added missing part to the JS.

          • 2. Re: Dynamic action to refresh region -> show message to user
            Jaydarp-Oracle

            Hi Fred,

             

                 Your post has given me some questions...

                 If when page loads, that's the message displayed....

                 1- When does this message get to be hidden?

                 2- Wouldn't it show up whenever page is loaded? Instead of when Dynamic Action is triggered? (The Dynamic Action is not triggered each time page loads).

             

                 My intention is to trigger to show a message, only and as long for the Dynamic Action duration, before and after the Dynamic Action should be hidden.

                 Perhaps I missinterpreted what you meant with your post. Please, can you clarify?

                 Regards.

            • 3. Re: Dynamic action to refresh region -> show message to user
              Tom Petrus

              You could actually go several routes with a solution for this. An IR refresh will trigger the before and after refresh events which you can hook into with dynamic actions or jQuery, and thus would allow you to show something when the refresh starts and then hide it again. And since you can do this all in jQuery you could easily fit this in a javascript file and attach it to all ir pages. This is probably the cleanest and most independable solution.

              Another way is to use the already existing waiting icon and toy with its presentation a bit. You know, that loading icon you are talking about. You can change this to something much better with minimal effort!

              Example:

              Run on page load, execute javascript code:

              $("#apexir_LOADER").append("<div>Please wait. Refreshing the data.</div>");
              

               

              Add this css to the inline css on the page:

              span#apexir_LOADER {
              display: block;
              width: 150px;
              text-align: center;
              background-color: white;
              border-style: solid;
              border-radius: 5px;
              border-width: 2px;
              top: 20%;
              }
              

               

              This'll make a little white box with rounded black borders around the loading icon and put some text under it.

              You can make the html append a bit more generic, or you could lift some html from the page if required. You can put it in a dynamic action on load, put it in a js file or whatever. The css can be put in a page template or a css file.

              It's only less independable than hooking into before or after refresh because we're taking advantage of the system in place, which means that maybe it could change in the future - but it's hardly on the same scale as "hacking" the ir javascript for example.

              • 4. Re: Dynamic action to refresh region -> show message to user
                Fred-L

                Hi,

                 

                Sorry, there is an error in the code I gave you, It seems I missed the copy/paste .... it should be

                $("#apexir_LOADER").append('<div style="position: fixed; left: 50%; top: 50%; background-color: rgb(221, 221, 221); border-style: solid; border-width: 2px; border-color: rgb(119, 119, 119); padding: 5px;">The report is being refreshed, please wait</div>');
                

                The message is only displayed when the IR start to refresh and is hidden when the refresh is completed.

                 

                Basically, there is a SPAN with a show/hidden triggered by Apex when IR are refreshed

                Processing Request

                the code I gave you (very similar as Tom) add some stuff to this SPAN.

                 

                You should reuse Tom's code, it's more cleaner; mine was just a quick example to give you a direction than a ready-to-use

                • 5. Re: Dynamic action to refresh region -> show message to user
                  Jaydarp-Oracle

                  Hi guys,

                   

                       Thank you very much for your answers.

                       It worked as a charm...

                       Tom thank you for your detailed explanation, I did not say, but we recently migrated from Apex3.2 to Apex4.2.1 and I am not really aware of how to make jquery work, so your explanation was enough for me to make it work.

                       Thanks both again.

                       Regards.