0

I have a datatable in Primefaces which has sorting feature on click of column header, when I click on sort it sorts like this example Existing output:

        APPLE
        ORANGE
        ZEN
        apple
        orange
        zen

I would like the sort output to be like this on UI

        APPLE
        apple
        ORANGE
        orange
        ZEN
        zen 

Any suggestions would be greatly appreciated. Thank you.

Existing code:

                    <p:column id="firstName" 
                        sortBy="#{row.user.firstName}"
                        filterBy="#{row.user.firstName}"
                        styleClass="col-left" 
                        filterStyleClass="filter-full">

                        <f:facet name="header">
                            <h:outputText value="#{appmsg['first.name']}" />
                        </f:facet>

                        <h:outputText value="#{row.user.firstName}" />
                    </p:column>

1 Answers1

0

Primefaces has the option to plugin a custom sortFunction, see the documentation of the Datatable and Column

You can then sort whatever way you want. And if you use a LazyDatamodel, you have even more control.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47