Problem faced while upgrading to primefaces-5.0 and above

UI Components for JSF
mmiicchhaaeell
Posts: 7
Joined: 10 Aug 2017, 12:36

14 Aug 2017, 10:53

With JSF 2.0 I had used primefaces-3.4.2 in my application and datatable was working fine. I had to upgrade it to primefaces-5.0 due to jquery vulnerability issues. I am facing row selection problems with my datatable after upgrading primefaces to v5.0 ..that first time when the datatable loads, the datatable row selection does not work...it shows simple cursor, only when I click on any header to sort the datatable, then all the table body row selection and cursors begin to work.

I have tried to debug it using IE developer tools and observed that, when the datatable loads for the first time, the class ui-datatable-selectable is not getting applied, but after doing a sort on any of the column, the class is applied, as below ...

<tr class="ui-widget-content ui-datatable-odd" role="row" aria-selected="false" data-rk="11111" data-ri="1">....................</tr>

<tr class="ui-widget-content ui-datatable-odd ui-datatable-selectable" role="row" aria-selected="false" data-rk="11111" data-ri="1">.................</tr>

below is my datatable code -

<h:panelGrid id="dataTablePanel" styleClass="#{ManagedBean.mySearchResult==null?'SearchList_no_displayData':'SearchList_displayData'}">
<p:dataTable styleClass="myDataTable" value="#{ManagedBean.mySearchResult}" var="searchresult" widgetVar="mySearch_DataTable"
id="mySearch_DataTable" sortMode="multiple" rows="#{ManagedBean.rowsPerPage }" paginator="true" paginatorPosition="top"
currentPageReportTemplate="Showing {startRecord}-{endRecord} of {totalRecords} results |"
paginatorTemplate="{CurrentPageReport} {PreviousPageLink} {PageLinks} {NextPageLink}" first="#{dataTableControllPagination.first}" selectionMode="single"
selection="#{ManagedBean.selectedValue}" rowKey="#{searchresult.request_id}">
<p:ajax event="page" listener="#{dataTableControllPagination.onPageChange}"/>
<p:ajax event="rowSelect" listener="#{ManagedBean.onRowSelect}"/>

<p:column headerText="Ref #" align="center" sortBy="#{searchresult.ack_number}">
<h:outputText value="#{searchresult.ack_number}" />
</p:column>
<p:column headerText="Status" align="center" sortBy="#{searchresult.status}">
<h:outputText value="#{searchresult.status}" />
</p:column>

<p:column headerText="UID" align="center" sortBy="#{searchresult.uid}">
<h:outputText value="#{searchresult.uid}" />
</p:column>
<p:column headerText="xxxxx" align="center" sortBy="#{searchresult.xxxxx}">
<h:outputText value="#{searchresult.xxxxx}" />
</p:column>
</p:dataTable>
</h:panelGrid>

from our java code, I am setting this ..

dataTable.setValueExpression("sortBy", null);

Kindly advise/suggest on how to fix this issue.

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

15 Aug 2017, 12:40

- Start by reading the migrartion guide
- Then try a newer version to see if it is fixed in 5.1, 5.2, 5.3, 6.0, 6.1

mmiicchhaaeell
Posts: 7
Joined: 10 Aug 2017, 12:36

22 Aug 2017, 10:33

I have already tried with primefaces 5.1, 5.2, 5.3, 6.0, 6.1 and it did not fix my problem.

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

22 Aug 2017, 13:40

That is why I first stated : "Start by reading the migration guide"

mmiicchhaaeell
Posts: 7
Joined: 10 Aug 2017, 12:36

22 Aug 2017, 13:58

may I have the link (URL) to the Migration Guide please ?

And by the way, does my code snippet and implementation logic look good ? It should be, as it was working perfect with v3.4.2

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

22 Aug 2017, 15:05

Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

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

22 Aug 2017, 16:12

The formatting of your code is a bit weird so it is difficult to read. And things that worked with 3.4.x regarding the datatable are not guaranteed to work with 5.0 and up (important improvements have been made). And it is best to switch to 6.1 so you do not immediately have a 'legacy system' again

mmiicchhaaeell
Posts: 7
Joined: 10 Aug 2017, 12:36

01 Sep 2017, 12:02

Please clarify on the below points related to primefaces upgrade --

-- DataTable sortBy and filterBy expressions require the plain property name meaning "name" instead of "#{person.name}". Backward compatibility is maintained for expressions like "#{var.property}" but not for complex expressions.
Q: please elaborate on this point and help me understand how to use this in my code.

-- DataTable layout changed to table-layout:fixed.
Q: How to change the layout in code ?

-- DataTable frozen rows feature take an integer value instead of a collection from now on. This value defined how many rows from the start should be frozen.
Q: How to implement this in code ?

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

01 Sep 2017, 12:23

1: examples are in the showcase (and docs)
2: No clue what you ask here..
3: 3.4 did not have frozen rows if I remember correctly, nor did your example, so no need to upgrade here. Look in the showcase and docs

mmiicchhaaeell
Posts: 7
Joined: 10 Aug 2017, 12:36

05 Sep 2017, 17:59

Can you please share the link of the showcase (and docs)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 46 guests