dev@javaserverfaces.java.net

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

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Thu, 10 Sep 2009 00:54:11 -0400

>>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
Author of PrettyFaces URL Rewriting for JSF