I have the problem in a JSF / xhtml
page, that my primefaces datatable won't sort and filter correctly. I populate the datatable from my database, which works fine. However, as soon as I start to type something into the filter, or click on the header of a column to sort, all the entries disappear. I don't really know where my error here is.
This is the code of the datatable in JSF:
<p:dataTable var="c" value="#{proposalController.contractList}">
<p:column headerText="ID" sortBy="#{c.id}" filterBy="#{c.id}" filterMatchMode="contains">
<h:outputText value="#{c.id}" />
</p:column>
<p:column headerText="Customer Name" sortBy="#{c.custName}" filterBy="#{c.custName}" filterMatchMode="contains">
<h:outputText value="#{c.custName}" />
</p:column>
<p:column headerText="Asset" sortBy="#{c.asset}" filterBy="#{c.asset}" filterMatchMode="contains">
<h:outputText value="#{c.asset}" />
</p:column>
</p:dataTable>
And this is the java code behind it:
package controller;
import java.util.Date;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import model.Contract;
import model.ContractManager;
@ManagedBean (name="proposalController")
@SessionScoped
public class proposalController {
@EJB
private ContractManager contract;
private int id;
private String custName;
private String custStreet;
private String custZIP;
private String custCity;
private int creditScore;
private String custPers;
private String mail;
private String phone;
private Date start;
private Date endd;
private String asset;
private String insurance;
private double rate;
private String status;
private List<Contract> contractList;
public List<Contract> getContractList() {
this.contractList = contract.getContractList();
return this.contractList;
}
It would be great if someone could help me!