p:ajaxStatus and h:commandButton
Posted: 27 Aug 2010, 18:32
Hi all,
First excellent job to the Primefaces team on this library. I often find the function needed and the use is simple.
I now need to print an ajaxstatus when making an action. As Shown in the showcase this code works perfectly with p:commandButtons.
<p:ajaxStatus onstart="statusDialog.show();" oncomplete="statusDialog.hide();" />
<p:dialog modal="true" widgetVar="statusDialog" header="Processing" draggable="false" close="false" style="width:250px;height:20px;">
<p:graphicImage value="/resources/images/ajaxloadingbar.gif" />
</p:dialog>
However, i've never managed to use p:commandButtons to navigation. So i use classic h:commandButtons for navigation.
<h:commandButton action="doSomeAction_action" value="someAction" />
correspond to
public String doSomeAction_action() {
//some code
return "/pages/nextPage.xhtml";
}
<p:commandButton actionListener="doSomeAjaxAction" value="someAjaxAction" />
corresponds to
public void doSomeAjaxAction_action(javax.faces.event.ActionEvent e){
//Some code without navigation to nextpage
}
So has i said i never managed to navigate with p:commandButtons. However thay extends "classic" commandButton. Am i making something wrong ?
The resulting problem is that i can't use this statusbar on my navigation buttons. And some of them have very long process time (functional complexity). So the user has no informations about the progress and sometimes clicks again.
So to sum up have 2 questions :
1. Is it possible to navigate with p:commandButtons. If yes, the second question has no use. If not :
2. how can i have the same feature (ajaxstatusbar) on h:commandButtons ?
Hope i"ve been clear enough.
Thanks to all for your time and answers.
First excellent job to the Primefaces team on this library. I often find the function needed and the use is simple.
I now need to print an ajaxstatus when making an action. As Shown in the showcase this code works perfectly with p:commandButtons.
<p:ajaxStatus onstart="statusDialog.show();" oncomplete="statusDialog.hide();" />
<p:dialog modal="true" widgetVar="statusDialog" header="Processing" draggable="false" close="false" style="width:250px;height:20px;">
<p:graphicImage value="/resources/images/ajaxloadingbar.gif" />
</p:dialog>
However, i've never managed to use p:commandButtons to navigation. So i use classic h:commandButtons for navigation.
<h:commandButton action="doSomeAction_action" value="someAction" />
correspond to
public String doSomeAction_action() {
//some code
return "/pages/nextPage.xhtml";
}
<p:commandButton actionListener="doSomeAjaxAction" value="someAjaxAction" />
corresponds to
public void doSomeAjaxAction_action(javax.faces.event.ActionEvent e){
//Some code without navigation to nextpage
}
So has i said i never managed to navigate with p:commandButtons. However thay extends "classic" commandButton. Am i making something wrong ?
The resulting problem is that i can't use this statusbar on my navigation buttons. And some of them have very long process time (functional complexity). So the user has no informations about the progress and sometimes clicks again.
So to sum up have 2 questions :
1. Is it possible to navigate with p:commandButtons. If yes, the second question has no use. If not :
2. how can i have the same feature (ajaxstatusbar) on h:commandButtons ?
Hope i"ve been clear enough.
Thanks to all for your time and answers.