Showing posts from January 16, 2012

Easily disable sorting in PrimeFaces 3's DataTable

PrimeFaces provides a convenient and easy to use sorting facility for its DataTable. Together with Facelets, this facility allows us to create re-usable columns that are natural sortable by default. E.g.: <ui:composition xmlns="" xmlns:h="" xmlns:ui="" xmlns:p="" > <p:column headerText="#{headerText}" sortBy="#{value}"> <h:outputText id="#{id}" value="#{value}" /> </p:column> </ui:composition> Such a column can be used on a page inside a DataTable as follows: <my:sortableColumn id="foo" value="#{someBean.someValue}" /> The problem The above is only a simple example, and real-life usage can be more complex with e.g. default styles and cell editing capabilities added. With such complex tags, it might be…