I'm facing some problem updating my dataTable when I perform a filter operation with this:
<p:panel styleClass="card" header="Filtri">
<h:panelGrid columns="4" layout="grid"
styleClass="ui-panelgrid-blank form-group">
<h:panelGroup styleClass="md-inputfield">
<p:inputText id="orderMinFilter" label="N. bolla più basso"
value="#{productionOrdersView.orderNumberStartFilter}">
</p:inputText>
<p:outputLabel for="orderMinFilter" value="N. bolla più basso" />
</h:panelGroup>
<h:panelGroup styleClass="md-inputfield">
<p:inputText id="orderMaxFilter" label="N. bolla più alto"
value="#{productionOrdersView.orderNumberEndFilter}">
</p:inputText>
<p:outputLabel for="orderMaxFilter" value="N. bolla più alto" />
</h:panelGroup>
<p:commandButton value="Cancella filtri" icon="ui-icon-clear"
styleClass="red-btn flat"
actionListener="#{productionOrdersView.clearFilter()}"
style="width:auto;margin-bottom:10px; float:right;"
update="dtOrders" />
<p:commandButton value="Cerca" icon="ui-icon-search"
styleClass="primary-btn flat"
actionListener="#{productionOrdersView.filter()}"
update="dtOrders"
style="width:auto;margin-bottom:10px; float:right;" />
</h:panelGrid>
</p:panel>
This is my dataTable:
<p:dataTable id="dtOrders" var="productionOrder"
value="#{productionOrdersView.orders}" selectionMode="single"
reflow="true" selection="#{productionOrdersView.selected}"
filteredValue="#{productionOrdersView.filtered}"
widgetVar="ordersTable" rowKey="#{productionOrder.pk}"
emptyMessage="Nessun elemento oppure la ricerca è ancora attiva..."
paginator="true" rows="20">
And this is the method:
public void filter() {
if (orderNumberStartFilter != null && orderNumberEndFilter != null) {
this.orders = productionOrderController.findFromToOrderNumber(Integer.valueOf(orderNumberStartFilter),
Integer.valueOf(orderNumberEndFilter));
this.filtered = orders;
}
}
The filter() method is executed correctly and the list in the bean are correct (I search for 11 elements and I got it), but the dataTable is updated but not with these values; why? Where am I wrong?