You can achieve this with a little help from CSS and jQuery. Using CSS, you can create a class that changes the cursor to the entire document. With jQuery you can add / remove this CSS class. Under the covers, PrimeFaces uses jQuery for ajax magic, and for PrimeFaces <4 you can connect to standard jQuery ajaxStart and ajaxStop , and for PrimeFaces 4+ to PrimeFaces events specific to pfAjaxSend and pfAjaxComplete to add / remove this CSS class.
CSS
html.progress, html.progress * { cursor: progress !important; }
( !important overrides any style set by the style attribute and stronger CSS selectors for the case)
jQuery and PrimeFaces:
$(document).on("ajaxStart pfAjaxSend", function() { $("html").addClass("progress"); }).on("ajaxStop pfAjaxComplete", function() { $("html").removeClass("progress"); });
In this case, you also use the standard JSF <f:ajax> elsewhere and would like to have the same progress indicator as you can do this:
jsf.ajax.addOnEvent(function(data) { $("html").toggleClass("progress", data.status == "begin"); });
It is also used by the OmniFaces app . You can see this among others when you run a survey on this page .
Balusc
source share