0

I have a commandScript that runs when a page loads so that it loads a portion of the page asynchronously:

<o:commandScript name="refreshPowerStatus" action="#{powerBean.refreshPowerStatus}"
                         render="powerPanel"/>
<h:outputScript target="body">refreshPowerStatus()</h:outputScript>

I'd like this script to also be used every time a power-on/power-off action takes place, so I'm using functionality:

<h:commandButton value="Power On" action="#{powerBean.powerOn}">
    <f:ajax execute="@this" render="@form"/>
    <ace:ajax execute="@this" onComplete="refreshPowerStatus()" render="powerPanel"/>
</h:commandButton>

The refreshPowerStatus() call, however, causes the hourglass wait cursor to appear.

Is there a non-CSS hack way of getting this to go away? Or to at least only have the wait cursor to appear over the button that is pressed? There is no wait cursor on page load when its run automatically so I'm wondering if there is something similar I can do.

wsaxton
  • 1,030
  • 15
  • 34
  • Tried using the ajax onstart event and use jquery to set the cursor (or a class on the button)? And 'reset' it again in the oncomplete? – Kukeltje Nov 05 '15 at 17:39
  • I could probably do that as a last resort, but I consider that equal to a CSS hack. Just wondering if there is a "right" way of doing it first :) – wsaxton Nov 05 '15 at 17:49
  • The setting of a cursor is **always** done via css. Either via the javascript api via jquery (or directly) or by creating a class that has this cursor and defining that in a css rule and applying or removing it from an html tag. That is 'just' the way it works. No other options that I can think of, sorry. Also curious why you think both are a hack? – Kukeltje Nov 05 '15 at 17:59
  • See: but that is the other way around. http://stackoverflow.com/questions/15737801/change-mouse-cursor-to-busy-mode-when-primefaces-ajax-request-is-in-progress – Kukeltje Nov 05 '15 at 18:01
  • I guess "hack" is the wrong word. I'm just wondering if there is a more elegant way of not having the cursor do this in the first place. I mean, when the page loads and runs the javascript, no cursor appears at all. Therefore, I assumed, there was something I could do to have it behave the same way! – wsaxton Nov 05 '15 at 18:20
  • wait a minute... cursor appears at 'onComplete' (It is oncomplete btw)? Sure the isn't something in the omnifaces call that does this? I see the behaviour in http://showcase.omnifaces.org/components/commandScript to... and that uses the default jsf ajax call: https://github.com/omnifaces/omnifaces/blob/2.1/src/main/java/org/omnifaces/component/script/CommandScript.java – Kukeltje Nov 05 '15 at 18:30
  • Hmmm in the omnifaces showcase: _"Note: the progress indicator on the mouse cursor isn't JSF default, it's specific to this showcase application. So, if you actually didn't want to show one for polls in your application, you're by default already set."_ So for PrimeFaces it is not the default, for OmniFaces it is not, but you **do** see it. Please create an [mcve] and check your code – Kukeltje Nov 05 '15 at 18:37
  • Sorry, I put primefaces in instead of icefaces because I assumed (it looks like incorrectly) that it would exhibit the same behavior and primefaces gets more love here. I've gone and fixed it. (Sorry for the confusion) – wsaxton Nov 05 '15 at 19:04
  • you forgot an edit: The title. And there is a reason PrimeFaces gets more love ;-) And now it looks like I tried to answer an IceFaces question... yuck... ;-) – Kukeltje Nov 05 '15 at 19:06
  • Thanks (yes, I wish we were using Primefaces but we're stuck with ICEfaces for the foreseeable future!) – wsaxton Nov 05 '15 at 19:07

0 Answers0