Bem, tenho alguns problemas com o paginator do PrimeFaces, não estou entendendo o porquê, mas, simplesmente não funciona.
Eu tenho uma tabela de “lista de pedidos realizados” e o paginator só funciona quando eu abro um dialog de algum detalhe de algum produto.
Tentei colocar o bean de session e de view, mas ainda nada.
@Component
@Scope("session")
public class MyOrdersBean extends AbstractBean {
private static final long serialVersionUID = -2605122305959108180L;
@Autowired
private UserSession session;
@Autowired
private IUserDAO userDao;
private User user;
private Order selectedOrder;
private List<Item> itens = new ArrayList<Item>();
@PostConstruct
public void init() {
user = session.getUser();
}
public List<Order> getOrders() {
return userDao.getById(user.getId()).getOrders();
}
public List<Item> getItens() {
return selectedOrder.getItens();
}
public Order getSelectedOrder() {
return selectedOrder;
}
public void setSelectedOrder(Order selectedOrder) {
this.selectedOrder = selectedOrder;
}
}
meu bean…
e minha pagina:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="/template.jspx">
<ui:define name="body">
<h:head>
<title>Pizzaria</title>
</h:head>
<h:body>
<h:form id="form">
<p:growl id="growl" showDetail="true" sticky="true" />
<p:dataTable rowStyleClass="line1; line2" id="orders" var="order"
value="#{myOrdersBean.orders}" rowKey="#{order.description}"
paginator="true" rows="10" >
<f:facet name="header"> #{msg.my_orders} </f:facet>
<p:column headerText="#{msg.value}">
#{order.value}
</p:column>
<p:column headerText="#{msg.pizzeria}">
#{order.pizzeria.name}
</p:column>
<p:column style="width:32px">
<p:commandButton icon="ui-icon-search"
update=":j_idt6:form:detailsDialog" oncomplete="details.show()">
<f:setPropertyActionListener value="#{order}"
target="#{myOrdersBean.selectedOrder}" update="form"/>
</p:commandButton>
</p:column>
</p:dataTable>
<p:dialog id="detailsDialog" style="width:500px" widgetVar="details"
header="#{msg.order_details}">
<h:panelGrid columns="1">
<h:outputText styleClass="label"
value="#{myOrdersBean.selectedOrder.pizzeria.name}" />
<h:outputText styleClass="label"
value="#{myOrdersBean.selectedOrder.value}" />
</h:panelGrid>
<p:dataTable rowStyleClass="line1; line2" id="tableProducts"
value="#{myOrdersBean.itens}" var="item"
rendered="#{not empty myOrdersBean.selectedOrder.itens}">
<p:column headerText="#{msg.name_title}">
#{item.product.description}
</p:column>
<p:column headerText="#{msg.price}">
#{item.product.value}
</p:column>
<p:column headerText="#{msg.quantity}">
#{item.quantity}
</p:column>
</p:dataTable>
</p:dialog>
</h:form>
</h:body>
</ui:define>
</ui:composition>
</html>
Alguém sabe o que isso pode ser?
Obrigado desde já!