myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Wessendorf" <mat...@apache.org>
Subject Re: [Trinidad] how to know that PPR is ongoing
Date Wed, 23 Jan 2008 08:20:57 GMT
ok,
there is a statusIndicator comp., but that is not JS.

so here is a "monitoring ppr" JS:


     var requestQueue = TrPage.getInstance().getRequestQueue();
     requestQueue.addStateChangeListener(myCallback);


function myCallback(state)
{
  var busy = state == TrRequestQueue.STATE_BUSY;
  var div = document.getElementById("load");
  div.style.display = busy ? "inline" : "none";
}


a div like this could be in the page:
<div id="load" style="display: none; background-color: red;..."> LOADING...
</div>


we also have a DOM replace notification, after PPR

TrPage.getInstance().addDomReplaceListener(myCallback);

function myCallback(oldDom, newDom)
{ ...}

I think more on that is in the dev-guide.

-Matthias
On Jan 22, 2008 11:56 PM, Renzo Tomaselli <renzo.tomaselli@tecnotp.it> wrote:
> Hi, assume to have a component which might be rendered either in a full
> page or in a PPR context.
> It needs to distinguish these alternatives since it might run some js
> chunck requiring full DOM completion.
> For example, on IE we are not allowed to modify the DOM before page
> completion, thus we must delay by means of onLoad handling.
> How do we know "officially" from js that we are in a PPR ?
> Suggestions are welcome.
>
>
>



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Mime
View raw message