You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Renzo Tomaselli <re...@tecnotp.it> on 2008/01/23 08:56:40 UTC
[Trinidad] how to know that PPR is ongoing
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.
Re: [Trinidad] how to know that PPR is ongoing
Posted by Matthias Wessendorf <ma...@apache.org>.
Hi,
On Jan 23, 2008 7:16 PM, Renzo Tomaselli <re...@tecnotp.it> wrote:
>
> Thanks Matthias.
> To clarify further - from the perspective of some js inserted into some
> xhtml code - is that busy state meaning that we are in a PPR context ?
> I ask since from the dev-guide it seems that busy/free refers to the status
> of getting the response from the server and js executes while modifying the
> DOM, e.g. when the response is achieved.
> Which are the exact triggering events to define a state change - or in
> other words - is the busy time including DOM updating ?
the busy includes the domElement.replaceChild();
-Matthias
>
> -- Renzo
>
>
>
> Matthias Wessendorf wrote:
> 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 <re...@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
Re: [Trinidad] how to know that PPR is ongoing
Posted by Matthias Wessendorf <ma...@apache.org>.
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 <re...@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