How to sort and clutter a datatable in JSF by clicking the column?

0
Well, I have a JSF application, I would like to know how to sort and clutter datatable when clicking on the column, in that table there are 6 columns and 3 of them would like me to click it to sort according to the clicked column?

* On-demand query

    
asked by anonymous 03.05.2014 / 17:53

1 answer

4

If you are using or can use Primefaces, simply include the "sortBy" property in your column

<p:dataTable value="#{testeMB.objetos}" var="o">
  <p:column headerText="Nome" sortBy="#{o.nome}">
    #{o.nome}
  </p:column>
</p:dataTable>
    
07.07.2014 / 22:47