This discussion is archived
5 Replies Latest reply: Feb 28, 2013 11:23 AM by VC RSS

Delay rendering of a region on a page APEX 4.2

HarryF Newbie
Currently Being Moderated
I have a page with two regions. the second is causing a huge delay. I want to delay the rendering of the second region so the users can see the first region immediately. A button to display the region is an option. I tried this on page load:

var t=setTimeout(function(){display()},3000)

function display () {
if ($v('P13_HIDE') == 'Y') {
$x('P13_HIDE').value = 'N';
doSubmit();//
}
}

I used the P13_HIDE to conditionally display the second region. It worked but I have another problem. The submit is interfering with a plug in we use to make all pop-ups modal. So I need to do this with javascript to avoid a submit.
  • 1. Re: Delay rendering of a region on a page APEX 4.2
    scott.wesley Guru
    Currently Being Moderated
    What is causing the delay?

    Random idea - could you by default return no rows (is it a query?) and hide the region, then on page load invoke a refresh of just the region with the conditional filter removed?
  • 2. Re: Delay rendering of a region on a page APEX 4.2
    HarryF Newbie
    Currently Being Moderated
    The delay is the region is using a tabbed plugin that has a lot of pages. This plugin loads all pages on the tabs when the page opens. We tried having the query return nothing on load. That did not seem to help. We may try the hiding of the region on initial load on a larger scale. But that requires code in every called page.

    We can change it to not have so many pages but I want to see if there is an approach that allows me to change just the page with the tabs.

    Internally APEX is doing this so there must be a way. I am not a javascript/jQuery expert so I am not sure how to do this.
  • 3. Re: Delay rendering of a region on a page APEX 4.2
    VC Guru
    Currently Being Moderated
    HarryFerrari wrote:
    I have a page with two regions. the second is causing a huge delay. I want to delay the rendering of the second region so the users can see the first region immediately. A button to display the region is an option. I tried this on page load:

    var t=setTimeout(function(){display()},3000)

    function display () {
    if ($v('P13_HIDE') == 'Y') {
    $x('P13_HIDE').value = 'N';
    doSubmit();//
    }
    }
    It doesn't work that way because javascript will only comes into picture when the components are loaded, that means no point hiding the region using js.
    I used the P13_HIDE to conditionally display the second region. It worked but I have another problem. The submit is interfering with a plug in we use to make all pop-ups modal. So I need to do this with javascript to avoid a submit.
    HarryFerrari wrote:The delay is the region is using a tabbed plugin that has a lot of pages. This plugin loads all pages on the tabs when the page opens. We tried having the query return nothing on load. That did not seem to help. We may try the hiding of the region on initial load on a larger scale. But that requires code in every called page.
    How are the pages loaded in the second region? iframes?
    We can change it to not have so many pages but I want to see if there is an approach that allows me to change just the page with the tabs.
    Your solution would be loading the pages (in second region) using ajax once the actual/main page is ready/loaded

    See this post http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/

    and demo http://nettuts.s3.amazonaws.com/412_ajaxCalls/DEMO/index.htm
  • 4. Re: Delay rendering of a region on a page APEX 4.2
    HarryF Newbie
    Currently Being Moderated
    Yes, iframes.

    I am using the MBNDATA plug-in
    http://apex-plugin.com/oracle-apex-plugins/region-plugin/mbndata-tabs_44.html

    That plug in has a PL/SQL function:
    function render_region_tabs(p_region in apex_plugin.t_region,
    p_plugin in apex_plugin.t_plugin,
    p_is_printer_friendly in boolean)
    return apex_plugin.t_region_render_result

    I can see the javascript for this plug in but not sure how to call this function from within APEX.
  • 5. Re: Delay rendering of a region on a page APEX 4.2
    VC Guru
    Currently Being Moderated
    You would probably get some help from the plugin author!

Legend

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