dev@javaserverfaces.java.net

Re: jsf.ajax.addOnEvent() is not triggering events for <f:ajax>

From: Jim Driscoll <Jim.Driscoll_at_Sun.COM>
Date: Thu, 10 Sep 2009 08:41:30 -0400

Hey Lincoln -

Saw your comment on my blog as well.

If you look at the code of that blog, you'll note that I'm using
<f:ajax render="blah"> in my blog's example - and it's working fine.

There's something else you're doing that's making it not work.

Moreover, there's no significant clientside difference between
jsf.ajax.request and f:ajax where events are concerned - they're going
to hit the same codepath. So whatever's going on, it's unlikely to be
related to the difference between the two call methods.

Regardless, I'd still like to know what it is that's causing the event
to not get raised - are you sure that the ajax request is actually being
made?

Jim

On 9/10/09 12:54 AM, Lincoln Baxter, III wrote:
> >From what I understand of <f:ajax> and the events system for JSF2
> ajax, it should trigger these events for any AJAX request sent to the
> server.
>
> For instance, this script will change the mouse cursor to an hourglass
> when an AJAX event occurs, but while it works for manual calls to
> jsf.ajax.request() , it is not working for <f:ajax> events.
>
> Do I really need to specify the <f:ajax onevent="..." > on each tag in
> order to get this to work? That seems slightly off to me.
>
> Thoughts? Submit a bug?
> --Lincoln
>
>
> /**
> * ***************************************
> * Busy Status
> */
> if (!window["busystatus"]) {
> var busystatus = {};
> }
>
> busystatus.onStatusChange = function onStatusChange(data) {
> var status = data.status;
>
> alert("ajax event triggered")
> if (status === "begin") { // turn on busy indicator
> document.body.style.cursor = 'wait';
> } else { // turn off busy indicator, on either "complete" or "success"
> document.body.style.cursor = 'default';
> }
> };
>
> jsf.ajax.addOnEvent(busystatus.onStatusChange);
>
>
>
> --
> *Lincoln Baxter, III*
> Co-Founder of OcpSoft <http://ocpsoft.com>
> Author of PrettyFaces <http://ocpsoft.com/prettyfaces> URL Rewriting for JSF
>
>