I am using prime face for a web application, I'm having this problem which is I have a prime face Command Button with an action listener, when I click that button the actionListener doesn't get fired.
<p:dataTable var="car" value="#{cart.cartItems}" rendered="#{not empty cart.cartItems}">
<p:columnGroup type="footer">
<p:row>
<p:column colspan="3" footerText="Wallet Balance (#{cart.displayWalletAmount}) " style="text-align:right" />
<p:column>
<p:panel id="walPayPanel">
<p:inputText value="#{cart.payWalletAmount}" maxlength="7" size="5" id="walAmount" />
<p:spacer width="10" />
<p:commandButton actionListener="#{cart.updateTotalAmount}" update="totPay,totPaybel" id="iconOnly" title="update" icon="ui-icon-refresh" />
</p:panel>
</p:column>
</p:row>
<p:row>
<p:column colspan="3" footerText="Total Payble: " style="text-align:right" />
<p:column><p:panel id="totPay"><h:outputText id="totPaybel" value="#{cart.totalPayble}"/></p:panel> </p:column>
</p:row>
</p:columnGroup>
</p:dataTable>
And this the relevant code in the bean,
public void updateTotalAmount() {
log.info("Entering updateTotalAmount()");
log.info("Pay wallet Amount : "+payWalletAmount);
// Double total = getCartTotal();
if (payWalletAmount < 0.0) {
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Wallet Amount cannot be a minus value", null);
FacesContext.getCurrentInstance().addMessage(null, message);
} else if (payWalletAmount > (walletAmount)) {
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Wallet amount cannot be exceeded the available balance", null);
FacesContext.getCurrentInstance().addMessage(null, message);
}
}
Interesting thing is if I placed above command button out side of the data table, action listen is getting fired. Even if I add Actionevent param in the bean method, it doesnt work. Can someone tell me how can I solve this problem? Can this be done without moving the command button outside from data table or columnGroup?