For a project I'm working on, I am utilizing PrimeFaces ajax to retrieve elements on my web pages. To enhance user experience, I wanted to change the mouse cursor to a "busy cursor" during certain PrimeFaces ajax events that may take some time to complete.
To achieve this, I included the following code in my css file:
html.wait, html.wait * {
cursor: wait !important;
}
To toggle the class, I inserted the following code snippets in my xhtml files where the PrimeFaces components using ajax are located:
onstart="$('html').addClass('wait');"
oncomplete="$('html').removeClass('wait');"
These xhtml files reference a template xhtml file that links to the css file.
The initial test run after implementing these changes was successful, but later, upon logging out and back into my computer, the functionality stopped working. Despite no other alterations to the project, the issue remained inconsistent. After numerous login/logout attempts, it only worked properly for two sessions. When it does work, it remains functional throughout the session with all ajax events. Interestingly, if I copy the project and import it into another Eclipse environment, it works as expected. However, the inconsistency persists after subsequent logins.
Although unlikely related, my project is built using PrimeFaces 10.0.0 and JSF 2.2.9.
The sporadic behavior without any code modifications baffles me. Any suggestions or insights on what might be causing this would be greatly appreciated. If additional information would be helpful, please do let me know.
UPDATE
I attempted setting the global attribute to true on the PrimeFaces components while incorporating the following code:
<p:ajaxStatus onstart="$('html').addClass('wait');" oncomplete="$('html').removeClass('wait');"/>
This method also did not yield the desired outcome. As similar approaches work correctly, such as:
<p:ajaxStatus>
<f:facet name="start">
<h:outputText value="Sending" />
</f:facet>
<f:facet name="complete">
<h:outputText value="Done" />
</f:facet>
</p:ajaxStatus>
This suggests a potential issue with jQuery/css rather than PrimeFaces.
Update
A recent observation in the browser revealed that the updated css file with the specified line was not being utilized.