PrimeFaces dynamic columns sorting is not working

UI Components for JSF
Post Reply
jhula
Posts: 2
Joined: 07 Sep 2017, 10:00

22 Oct 2021, 10:16

Hello, I have a problem with sorting of the dynamic columns after upgrade to PF10. In PF8 it was working. I'm sorting over the string array, but the sort buttons are not displayed in the datatable.

Code: Select all

<p:dataTable id="table" var="item" widgetVar="table"
	value="#{bean.items}" rows="50"
	paginator="true" pageLinks="4"
	paginatorTemplate="{RowsPerPageInputText} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {CurrentPageReport} {Exporters}"
	rowsPerPageTemplate="50" paginatorPosition="bottom" sortMode="single">

	<p:columns value="#{bean.columns}" var="column"
		columnIndexVar="colIndex" headerText="#{column.header}" sortBy="#{item.values[column.index]}">
		<h:outputText value="#{item.values[column.index]}" rendered="#{!column.dateValue}" />
		<h:outputText value="#{item.changeDate.time}" rendered="#{column.dateValue}"/>
	</p:columns>
</p:dataTable>
Items displayed in the data table

Code: Select all

public class Items {
	protected String[] values;
	protected List<DataVO> extraData;
	protected Calendar date;
	// GETTERS
}

Columns model

Code: Select all

public class ColumnModel {
	protected String header;
	protected String property;
	protected int index;
	protected boolean dateValue;
	// GETTERS
}
PrimeFaces 10.0.0
Tomcat 9.0.53
JSF 2.3

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

25 Oct 2021, 13:42

I believe this is recently reported and fixed: https://github.com/primefaces/primefaces/issues/7986
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 33 guests