<p:datatable> header misaligned with row columns

UI Components for JSF
moutts
Posts: 54
Joined: 27 Oct 2010, 20:35

23 Aug 2011, 16:22

I used PrimeFaces 3.0-M3-SNAPSHOT in my application and yesterday I noticed lot of inconsistencies while loading the application. Later I noticed that PrimeFaces3.0-M3-SNAPSHOT is no more available for download in the primefaces website but somehow my maven is pulling down 3.0-M3 version jar file where the dataTable is crashing when loading "javax.servlet.ServletException: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled."

I assume PrimeFaces 3.0-M3-SNAPSHOT is rolledback for more development. My question is what is the PrimeFaces teams recommendation?

1) Should I use PrimeFaces 3.0-M2 to build my application which will be easier to upgrade when PrimeFaces 3.0 final stable release is available?
2) Or Should I use PrimeFaces 2.2.1 stable release and later upgrade the application to 3.0?

Please advice.

Thanks,

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

23 Aug 2011, 18:09

Hi,

M3 is due 29th so my suggestion would be to migrate to M3 once it is released.

moutts
Posts: 54
Joined: 27 Oct 2010, 20:35

31 Aug 2011, 16:53

Hi,
I have been waiting for Primefaces 3.0-M3 and noticed it was released. When I deploy my application with the new 3.0-M3 JAR, now I get the following exception when the datable is about to be loaded.

--------------------------------------------------------------------
javax.faces.FacesException: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled.
org.primefaces.component.datatable.DataTable.getRowKeyFromModel(DataTable.java:855)
org.primefaces.component.datatable.DataTable.findSelectedRowKeys(DataTable.java:906)
org.primefaces.component.datatable.DataTableRenderer.encodeTbody(DataTableRenderer.java:572)
org.primefaces.component.datatable.DataTableRenderer.encodeRegularTable(DataTableRenderer.java:227)
org.primefaces.component.datatable.DataTableRenderer.encodeMarkup(DataTableRenderer.java:205)
org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:95)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
javax.faces.render.Renderer.encodeChildren(Renderer.java:164)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:60)
org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:48)
org.primefaces.component.dialog.DialogRenderer.encodeContent(DialogRenderer.java:174)
org.primefaces.component.dialog.DialogRenderer.encodeMarkup(DialogRenderer.java:104)
org.primefaces.component.dialog.DialogRenderer.encodeEnd(DialogRenderer.java:40)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:389)
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:116)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
-----------------------------------------------------------------------------------------------------------------------

Do I need to make any changes in the <p:dataTable>?

Please advice...

Thanks,

User avatar
leventgny
Posts: 238
Joined: 24 May 2011, 16:49
Contact:

31 Aug 2011, 23:28

Hi,

With the latest PrimeFaces 3.0M3 release datatable selection uses rowKey attribute or a considered data model as SelectableDataModel.
Also keep going with live PF3.0 migration wiki on;
http://wiki.primefaces.org/display/Gene ... ide+to+3.0

Regards,
PrimeFaces Team Member

moutts
Posts: 54
Joined: 27 Oct 2010, 20:35

01 Sep 2011, 16:37

Hi,
I am not quite clear about your reply. I checked the migration guide which talks about SelectableDataModel. I would assume this will be related to Primefaces implementation and would not impact how the data is rendered in the UI. I checked the showcase labs and there is not much of a change in the code which I have been using for a while:

<p:dataTable id="sampleExplorer_table" value="#{dashboardPickerState.samples}" var="sample" scrollable="true" scrollHeight="425" liveScroll="true" scrollRows="20">
...
...
</p:dataTable>

This fails loading the datatable with the above mentioned exception in my earlier post but when replaced with earlier version of JAR everything works fine.

Can you be more specific in terms what needs to be done to make this functional without any exception?

Thanks in advance.

User avatar
leventgny
Posts: 238
Joined: 24 May 2011, 16:49
Contact:

01 Sep 2011, 22:04

Hi,

Using PrimeFaces DataTable with selection mode newly revised to handle complexity over other datatable behaviors. Then, if you use selection on datatable, you can use rowKey attribute like;
rowKey="#{sample.property}" property could be anything (name, id etc.) for labeling your rows.

Code: Select all

<p:dataTable id="sampleExplorer_table" value="#{dashboardPickerState.samples}" var="sample" scrollable="true" scrollHeight="425" liveScroll="true" scrollRows="20" selection="#{dashboardPickerState.selectedSample}" selectionMode="single" rowKey="#{sample.property}">
...
...
</p:dataTable>

Or you are able to use/extend SelectableDataModelWrapper or implement SelectableDataModel for more undercontrol cases.

Code: Select all

<p:dataTable id="sampleExplorer_table" value="#{dashboardPickerState.selectableDataModel}" ...>
..
</p:dataTable>
PrimeFaces Team Member

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

05 Sep 2011, 08:35

In addition, see live samples, some use rowKey attribute and some use selectableDataModel feature;

http://www.primefaces.org/showcase-labs ... leHome.jsf

moutts
Posts: 54
Joined: 27 Oct 2010, 20:35

07 Sep 2011, 22:52

Hi,
I understand about rowKey attribute and selectableDataModel for selection enabled datatable component. But I don't have selection enabled datatable, it is a simple livescroll enabled dataTable which is very similar to that one you have in your showcase under Live Scrolling section..
http://www.primefaces.org/showcase-labs ... olling.jsf

I am using the similar code :
--------------------------------
<p:dataTable id="sampleExplorer_table" value="#{dashboardPickerState.samples}" var="sample"
scrollable="true" scrollHeight="425" liveScroll="true" scrollRows="20">

<p:column style="width:30px">
<p:commandButton update=":samplePerformanceDialogContent" oncomplete="samplePerformanceDialog.show()" image="ui-icon ui-icon-search">
<f:setPropertyActionListener value="#{sample}" target="#{samplePerformanceBean.sample}" />
</p:commandButton>
</p:column>

<p:column sortBy="#{sample.id}" style="width:50px">
<f:facet name="header">
<h:outputText styleClass="headerText" value="Id"/>
</f:facet>
<h:outputText value="#{sample.id}"/>
</p:column>

<c:forEach var="displayMetric" items="#{dashboardPickerState.displayMetrics}">
<p:column rendered="#{displayMetric.show}" style="width:125px">
<f:facet name="header">
<h:outputText value="#{displayMetric.metric.name}"/>
</f:facet>
<h:outputText value="#{sample.metricValues[displayMetric.metric].value}">
<f:converter converterId="autoFormatConverter"/>
</h:outputText>
</p:column>
</c:forEach>
</p:dataTable>
--------------------------------------------------------------------------------------

The point I don't understand is why is that in your showcase examaple live scrolling datatable works fine and mine fails with exception

"javax.servlet.ServletException: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled."

Is your showcase examples using the latest primefaces-3.0.M3 version?

Am i missing something here in understanding the changes made to the datatable. Are you saying by default all datatable must implement SelectableDataModel or use rowKey attribute irrespective of even if we use a simple datatable component?

Please advice me if I am wrong...

Thanks,

moutts
Posts: 54
Joined: 27 Oct 2010, 20:35

07 Sep 2011, 23:09

I apologize for the confusion. I just realized the main template attempts to load another facelet which is using a selection enabled datatable. Please ignore my previous posting, I will make the necessary changes on that facelet and will update you.

Thanks,

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 13 guests