My JSF code goes like this:
<p:dataTable var="result" value="#{timerConfigurationJobList.model}" rows="10"
paginator="true" paginatorPosition="bottom"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="10,20,50" id="approvalTable" lazy="true">
<p:column sortBy="#{result.jobId}">
<f:facet name="header">
<h:outputText value="#{msg['content.jobList.jobId']}"/>
</f:facet>
</p:column >
</p:dataTable>
The result I get is this :
As can be seen in the picture: '123' is higher than '2', '4', '7' and '9'. I want it to come right at the end, so that it is 'numerically' sorted.
Am using Java and JSF 2.
Edit: In the lazy model I found this:
@Override
public final List<T> load(int first, int pageSize, String sortField, SortOrder sortOrder,
final Map<String, Object> filters) {
Map<String, Sort> sorts = new HashMap<>();
if (sortField != null) {
if (sortOrder.equals(SortOrder.ASCENDING)) {
sorts.put(sortField, Sort.ASC);
} else if (sortOrder.equals(SortOrder.DESCENDING)) {
sorts.put(sortField, Sort.DESC);
}
// unsorted can be ignored
}