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.
Problem faced while upgrading to primefaces-5.0 and above
-
- Posts: 7
- Joined: 10 Aug 2017, 12:36
I have already tried with primefaces 5.1, 5.2, 5.3, 6.0, 6.1 and it did not fix my problem.
-
- Posts: 7
- Joined: 10 Aug 2017, 12:36
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
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
-
- PrimeFaces Core Developer
- Posts: 3979
- Joined: 03 Dec 2010, 14:11
- Location: Bavaria, DE
- Contact:
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
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
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
-
- Posts: 7
- Joined: 10 Aug 2017, 12:36
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 ?
-- 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 ?
-
- Posts: 7
- Joined: 10 Aug 2017, 12:36
Can you please share the link of the showcase (and docs)
-
- Information
-
Who is online
Users browsing this forum: No registered users and 71 guests