I want to provide a progress bar using Primefaces for a server side event. My first attempt was to include an action to the button that fires also the Ajax progress bar:
<p:commandButton value="Start" type="button" action="#{userAction.doWork}" onclick="PF('pbAjax').start();PF('startButton2').disable();" widgetVar="startButton2" />
<p:progressBar widgetVar="pbAjax" ajax="true" value="#{userAction.progress}" labelTemplate="{value}%" styleClass="animated" global="false">
<p:ajax event="complete" listener="#{userAction.onComplete}" update=":form" oncomplete="startButton2.enable()"/>
</p:progressBar>
This does not work as the UserAction.doWork is not being called. So my second attempt was to provide an ajax event="start":
<p:progressBar widgetVar="pbAjax" ajax="true" value="#{userAction.progress}" labelTemplate="{value}%" styleClass="animated" global="false">
<p:ajax event="start" listener="#{userAction.go}" />
<p:ajax event="complete" listener="#{userAction.onComplete}" update=":form" oncomplete="startButton2.enable()"/>
</p:progressBar>
This does not work either as I get a " Event:start is not supported ."
Any suggestion to get called the userAction.go method ??
删除type="button"
,它将起作用。
<p:commandButton value="Start" action="#{userAction.doWork}" onclick="PF('pbAjax').start();PF('startButton2').disable();" widgetVar="startButton2" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.