how Sort date in dynamic columns

UI Components for JSF
Post Reply
medmjs
Posts: 17
Joined: 26 Nov 2014, 10:52

08 Dec 2014, 09:33

<p:dataTable id="users" editMode="row" editable="true" var="user" value="#{userBean.uservos}" sortOrder="descending" widgetVar="userTable" filteredValue="#{userBean.filteredUsers}">
<p:ajax event="rowEdit" listener="#{userBean.onRowEdit}" update="users" />
<p:columns value="#{userBean.columns}" var="column" columnIndexVar="colIndex" sortBy="#{user[column.property]}" filterBy="#{user[column.property]}">
<f:facet name="header">
<h:outputText value="#{column.header}" />
</f:facet>
<p:column>
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{user[column.property]}"></h:outputText></f:facet>
<f:facet name="input"><h:inputText value="#{user[column.property]}" styleClass="input ilarge" /></f:facet>
</p:cellEditor>
</p:column>
</p:columns>
<p:column headerText="Edit">
<p:rowEditor id="edit"/>
</p:column>
</p:dataTable>

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

08 Dec 2014, 10:39

Hi, please check the forum postingrules

mor
Posts: 48
Joined: 24 Jun 2013, 10:47
Location: Zürich

10 Dec 2014, 09:33

Hello, simply make sure the column object you have is the type "Date" and not string, otherwise the sorter will not work correctly... by column object I mean the value you return from the call

Code: Select all

<h:outputText value="#{user[column.property]}"
must be type date.

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

10 Dec 2014, 10:25

mor wrote:Hello, simply make sure the column object you have is the type "Date" and not string, otherwise the sorter will not work correctly... by column object I mean the value you return from the call

Code: Select all

<h:outputText value="#{user[column.property]}"
must be type date.
That is your job to post a fully working example that is as minimalistic as possible

And am I wrong in the assumption you do not need any help? There are othe things mentioned in the forun postingrules...

medmjs
Posts: 17
Joined: 26 Nov 2014, 10:52

11 Dec 2014, 09:12

thank you mor

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 26 guests