Created
July 30, 2012 14:08
-
-
Save lezi/3207114 to your computer and use it in GitHub Desktop.
Show Global Ajax Status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * *************************************** | |
| * Show busy status. | |
| * Original from POST: http://ocpsoft.org/java/jsf-java/jsf2-how-to-create-a-global-ajax-status-indicator/ | |
| */ | |
| 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 = 'auto'; | |
| } | |
| }; | |
| jsf.ajax.addOnEvent(busystatus.onStatusChange); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment