This discussion is archived
7 Replies Latest reply: Nov 17, 2013 11:59 PM by BillyVerreynne RSS

Visual busy cue for dynamic action

BillyVerreynne Oracle ACE
Currently Being Moderated

I have a dynamic action that is fired from an onclick on a column in an IR - the (serialised) action uses PL/SQL to build an Anychart XML and then opens a Jquery dialog (floating) window/region that renders the graph. (Apex 4.2..2.x)

 

In some cases it takes several seconds for the PL/SQL part to execute -  which means no visual cues to the web user that the page is busy processing. Instead of hacking custom Jquery regions for spinner images and the like, I would rather stick to standard Apex functionality. So what would the proper way be to deal with this?

 

Any pointers/doc references will be appreciated. Thanks.

  • 1. Re: Visual busy cue for dynamic action
    kvlek Journeyer
    Currently Being Moderated

    Hi Billy,

     

    You could transfer the PL/SQL part in you DA to an "on demand process"and trigger that process from the java (jquery) part in your DA.

    this would look something like this:

     

     

    var lRequest = new htmldb_Get(null, $v('pFlowId'), 'APPLICATION_PROCESS=BUILD_ANYCHART_XML_PROCESS', $v('pFlowStepId'));

     

     

    Regards,

    Kees Vlek

    -----

    Company: http://www.orcado.nl

    Blog: http://www.orcado.nl/blog/blogger/listings/69-kvlek

    Twitter: http://www.twitter.com/skier66

    +If the question is answered please change it to answered and mark the appropriate post as correct/helpfull.+

  • 2. Re: Visual busy cue for dynamic action
    BillyVerreynne Oracle ACE
    Currently Being Moderated

    Thanks. But on-demand processing makes thing a bit less transparent - the Apex app needs to be managed from a developer perspective by guys from our product management team and I want to make it as easy to understand as possible. Which I believe my current attempt is.

     

    I've tried a CSS approach. Goes something like this: document.body.className='waiting';doAction();document.body.className=''; - where "waiting" sets the document cursor to waiting.

     

    This (initial waiting command setting) works on its own (via console for example) - but the cursor remains the cursor setting of the column style (pointer) that triggers the event sequence. Almost seems like execution does not pause long enough to refresh the document cursor as a wait cursor... (in Delphi I would have done an object refresh call to allow the GI to update). But I'm pretty much noobish when it comes to Javascript.

  • 3. Re: Visual busy cue for dynamic action
    Tom Petrus Expert
    Currently Being Moderated

    You could try the built-in wait popup usually used for on-submit loading indicator:

    apex.widget.waitPopup();

    There is no removal method for it though but it is fairly straightforward and easy enough as it's plain html

    $("#apex_wait_popup,#apex_wait_overlay").remove();
  • 4. Re: Visual busy cue for dynamic action
    BillyVerreynne Oracle ACE
    Currently Being Moderated

    Thanks. Still does not work.

     

    I've changed the dynamic action to do the Javascript call for showing a wait (e.g. apex.widget.waitPopup(); ) , PL/SQL call (populates a text item with XML), and a Javascript call to remove the wait.

     

    The wait effect (popup, wait cursor, etc) does not render - and I've tried a couple of method to provide a visual cue.

     

    It as if the browser's GDI does not get a chance to refresh and display that wait effect, prior to doing the PL/SQL (Ajax) call.

  • 5. Re: Visual busy cue for dynamic action
    Kofi Journeyer
    Currently Being Moderated

    Interesting, it worked for me. Thanks Tom, something new learned.

    The only caveat was that when the PSQL executed very quickly, there was a very quick blip and it was gone but that worked for me since I wanted the visual cue only as long as there was a delay.

    Cheers

    Kofi

  • 6. Re: Visual busy cue for dynamic action
    Tom Petrus Expert
    Currently Being Moderated

    Weird - that should work. When you run it from the browser's developer tools console - can you see it pop up?

    Is the PLSQL synchronous ("wait for result" is checked) or not? If it is asynchronous then this would make sense as the call will initiate but not further block the browser, causing near immediate execution of the removal code. I'm not sure there is an easy fix for that within the limit of the dynamic action framework as there is no sort of hook for the success method of the made call. The only option would be to fire an ajax call manually, from javascript code, using apex.server.process, with the plsql code in an on-demand process.

  • 7. Re: Visual busy cue for dynamic action
    BillyVerreynne Oracle ACE
    Currently Being Moderated

    Yes, everything works fine via console when called manually and individually.

     

    The dynamic action is serialised - which means Javascript runs (show busy cue), PL/SQL call runs, and then Javascript again (hide busy cue). A total of 3 "true" actions in the dynamic action.

     

    Will play around some more with it..

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points