ive got a Primefaces DataTable like this
<p:dataTable
value="#{valueList.value}"
var="value"
selection="#{valueList.selected}"
id="measurementTable"
paginator="true"
rows="20"
rowsPerPageTemplate="20,25,30,35,40"/>
and dynamic Columns with this
<p:columns
value="#{valueList.columns}"
var="column"
columnIndexVar="colIndex"
/>
this works fine and my Datatable looks good , but when i add
sortBy="#{value.charge}"
to p:columns and i was click on column to sort the css style is destroyd and ive got a List with my Data not a DataTable, this is very ugly.
My code
<p:dataTable
value="#{measurementList.measurements}"
var="measurement"
selection="#{measurementList.selected}"
id="measurementTable"
paginator="true"
rows="20"
rowsPerPageTemplate="20,25,30,35,40"
rowKey="#{measurement.mdkFid}"
emptyMessage="#{measurementList.getCapString('no_records_found')}">
<p:column selectionMode="multiple" style="width:18px" />
<p:column>
<p:commandLink title="#{measurementList.getString('edit')}" update=":contentPanel">
<h:outputText styleClass="ui-icon ui-icon-pencil" />
<f:actionListener binding="#{measurementList.editSelected(measurement) }" />
<f:actionListener binding="#{navigation.goTo('/xhtml/measurements/editMeasurement.xhtml') }" />
</p:commandLink>
</p:column>
<p:columns
value="#{measurementList.columns}"
var="column"
columnIndexVar="colIndex"
styleClass="measurementListDatatableColumn"
sortBy="#{column.displayName}"
>
<f:facet name="header">#{column.displayName}</f:facet>
<p:column>
#{measurement[column.methodName]}
</p:column>
</p:columns>
emptyMessagefrom your backing bean's method? You can directly use#{msg[SOME_MESSAGE_KEY]}and put a<f:loadBundle var="msg" basename="org.example.localization.project" />in your "master" template. Then createproject_XX.bundlein the said package (source code) and it should be loaded. - Roland