I tried to follow the Sorting DataTable example on ShowCase, but it does not work.
Here is the sample code I experienced problem:
Code: Select all
<?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:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:form >
<p:dataTable var="item" value="#{customer.customers}" >
<f:facet name="header">
Customers
</f:facet>
<p:column sortBy="#{item.customerId}" >
<f:facet name="header">
<h:outputText value="CustId" />
</f:facet>
<h:outputText value="#{item.customerId}" />
</p:column>
<p:column sortBy="#{item.zip}">
<f:facet name="header">
<h:outputText value="Zip" />
</f:facet>
<h:outputText value="#{item.zip}" />
</p:column>
<p:column sortBy="#{item.city}">
<f:facet name="header">
<h:outputText value="City" />
</f:facet>
<h:outputText value="#{item.city}" />
</p:column>
<p:column sortBy="#{item.state}">
<f:facet name="header">
<h:outputText value="State" />
</f:facet>
<h:outputText value="#{item.state}" />
</p:column>
</p:dataTable>
</h:form>
</h:body>
</html>
Please let me know if there is anything wrong in my coding and will appreciate any suggestion.
Thank you very much in advance.
Sam