jsf - How to update primefaces attribute? -
i have <p:commandbutton disabled="#{scannerstatus.disabled}" actionlistener="#{scannerstatus.activate}" id="button-id"/>
in scannerstatus have:
private boolean disabled; // plus geters , setters
public void activate() { this.setdisabled(true); boolean status = doanaction(); // takes seconds if (!status) { dosomething(); } else { this.setdisabled(false); } } the problem disabled attribute of commandbutton not change when this.setdisabled(true) line activate method called.
i need seconds disabled attribute commandbutton true.
the disabled property set false , disabled attribute commandbutton updated. update in commandbutton takes place after function ends.
how can update attribute of commandbutton when this.setdisabled(true) in method activate?
i have tried use
requestcontext.getcurrentinstance().update("button-id");
after this.setdisabled it's not working.
not tested, should it:
<p:commandbutton actionlistener="#{scannerstatus.activate}" id="button-id" onstart="document.getelementbyid('button-id').disabled = true;" oncomplete="document.getelementbyid('button-id').disabled = false;" />
Comments
Post a Comment