Vote count:
0
I presented the following problem. when done click the button located in the dialog (pop -up ), the actionListener attribute does not work , ie not call the Backingbean.
The strange thing is that in the version PrimeFaces showcase this code works perfectly , only mobile fails. Another curiosity is that the javascript function button is successful, what makes me think it's a problem of ajax for mobile version Here the code
<ui:composition xmlns="http://ift.tt/lH0Osb"
xmlns:f="http://ift.tt/HcrI1S"
xmlns:h="http://ift.tt/HjFrZb"
xmlns:ui="http://ift.tt/KsEgXx"
xmlns:p="http://ift.tt/HjFrZc"
xmlns:pm="http://ift.tt/UAHBvg">
<pm:content>
<h:form id="productForm">
<p:dataList value="#{productoMB.productList}" var="pro"
paginator="true" id="productDL">
<f:facet name="header">Menu de comidas</f:facet>
<p:panel header="#{pro.name}" style="text-align:center">
<h:panelGrid columns="1" style="width:100%">
<p:commandLink update=":homeFirst:productForm:productDetail"
oncomplete="PF('productDialog').show()" title="Ver Detalles">
<h:graphicImage library="images" name="#{pro.path}" width="320px"
height="120px" />
<f:setPropertyActionListener value="#{pro}"
target="#{productoMB.productSelect}" />
</p:commandLink>
</h:panelGrid>
</p:panel>
</p:dataList>
<p:dialog header="Detalle Plato" widgetVar="productDialog"
modal="true" showEffect="fade" hideEffect="fade" resizable="false">
<p:outputPanel style="text-align:center;">
<p:panelGrid id="productDetail" columns="2"
rendered="#{not empty productoMB.productSelect}"
columnClasses="label,value">
<f:facet name="header">
<p:graphicImage library="images"
name="#{productoMB.productSelect.path}.jpg" width="100px"
height="100px" />
</f:facet>
<h:outputText value="Nombre:" />
<h:outputText value="#{productMB.productSelect.name}" />
<h:outputText value="Precio" />
<h:outputText value="#{productoMB.productSelect.price}" />
<h:outputText value="Detalles:" />
<h:outputText value="#{productoMB.productSelect.description}" />
<h:outputText value="Cantidad:" />
<h:inputText value="#{productoMB.quantity}" required="true">
<!-- <p:ajax update="costo" listener="#{empMB.calcularPrecioTotal}" /> -->
<!-- <f:validateDoubleRange minimum="0" maximum="200" /> -->
</h:inputText>
<h:outputText value="Total a Pagar:" />
<!-- <h:outputText id="costo" value="#{empMB.precioTotal}" /> -->
<p:commandButton value="Volver"
onclick="PF('productDialog').hide()"></p:commandButton>
<p:commandButton value="Agregar al carrito"
onclick="PF('carDialog').hide()" icon="ui-icon-cart" action="#{productoMB.addCart}" ajax="false">
</p:commandButton>
</p:panelGrid>
</p:outputPanel>
</p:dialog>
</h:form>
</pm:content>
This is a backingbean
package ar.com.as.presentation.mb;
import java.util.ArrayList;
import java.util.List;
import ar.com.as.business.bo.interfaces.GenericBO;
import ar.com.as.business.bo.patterns.FactoryFacade;
import ar.com.as.model.Cart;
import ar.com.as.model.Product;
public class ProductMB {
private List<Product> productList;
private Product productSelect;
private int quantity;
private List<Cart> cartList;
public ProductMB() {
productList = new ArrayList<Product>();
cartList = new ArrayList<Cart>();
findAllProduct();
}
public List<Product> getProductList() {
return productList;
}
public void setProductList(List<Product> productList) {
this.productList = productList;
}
public Product getProductSelect() {
return productSelect;
}
public void setProductSelect(Product productSelect) {
this.productSelect = productSelect;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public List<Cart> getCartList() {
return cartList;
}
public void setCartList(List<Cart> cartList) {
this.cartList = cartList;
}
public void findAllProduct() {
GenericBO<Product> productBO = FactoryFacade.createFacade("facade")
.getInstance().create("product");
productList = productBO.findAll();
}
public void addCart() {
System.out.println("se agrego al carrito");
}
} Any idea Como esta Problem solved .Or How to run the method addcart without ajax . From already thank you very much . Regards, Santiago
asked 1 min ago
Primefaces Mobile commandButton not working with ActionListener
Aucun commentaire:
Enregistrer un commentaire