PrimeFaces 10.0.0.0
Wildfly 25 final
Harmony 3.0.1
Java 11
The data loads just fine in the table. I can sort either of the columns multiple times and everything works. The issue is if I filter a column the apply a sort. The data in the table goes away leaving empty rows. The number of the empty rows matches the number of rows that are rendered when filtered. I basically copied this code from code for PrimeFaces circa 6.0.2, I think. And, it all works fine in that environment. I welcome any feedback and help. I've been stumped for days on this issue.
Thank you.
xhtml:
Code: Select all
<ui:composition 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:p="http://primefaces.org/ui"
template="/WEB-INF/template.xhtml">
<ui:define name="title">My Dashboard</ui:define>
<ui:define name="viewname">
<li>Pages</li>
<li>/</li>
<li><p:link outcome="/empty">My Dashboard</p:link></li>
</ui:define>
<ui:define name="content">
<!-- div class="p-grid">
<div class="p-col-12">
-->
<div class="card">
<h:form id="reg">
<h2>Member Registration</h2>
<p:dataTable id="memberRegistrationTableId" var="memberRegistration"
value="#{testController.tests}"
editable="false"
rowIndexVar="rowIndex"
class=".ui-datatable-striped"
filteredValue="#{testController.filteredValues}"
reflow="true"
showGridlines="true">
<p:column headerText="Id" style="width: 35%;" sortBy="#{memberRegistration.testId}">
<h:outputText value="#{memberRegistration.testId}"/>
</p:column>
<p:column headerText="Name" style="width: 35%;" sortBy="#{memberRegistration.name}" filterBy="#{memberRegistration.name}" filterMatchMode="contains">
<h:outputText value="#{memberRegistration.name}"/>
</p:column>
</p:dataTable>
</h:form>
</div>
<!-- /div>
</div>
-->
</ui:define>
</ui:composition>
Code: Select all
@Named
@ViewScoped
public class TestController implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@EJB
private BSHIService bshiService;
private List<Test> tests;
private List<Test> filteredValues;
@PostConstruct
public void postConstruct() {
tests = bshiService.getServiceName();
}
public List<Test> getTests() {
return tests;
}
public List<Test> getFilteredValues() {
return filteredValues;
}
public void setFilteredValues(List<Test> filteredValues) {
this.filteredValues = filteredValues;
}
}
Code: Select all
public class Test {
private Long testId;
private String name;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long getTestId() {
return testId;
}
public void setTestId(Long testId) {
this.testId = testId;
}
@Column(name = "name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int hashCode() {
return Objects.hash(name, testId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Test other = (Test) obj;
return Objects.equals(name, other.name) && Objects.equals(testId, other.testId);
}
}