p:dataTable strange selection problem

UI Components for JSF
Post Reply
garethwebbley
Posts: 23
Joined: 06 Mar 2011, 22:35

18 Apr 2011, 23:05

I have a p:dataTable with 3 columns. Each column has a header and each row is a single h:outputText. The center column also calls a JSF function I have written. I am using single selection mode. When rendered selection is working on the first and third columns but not on the second column. If I remove the call to my function everything works as expected. Why is my function causing this problem?

The function just replaces newlines (\n) in the text value with <p> tags i.e. it converts the text into paragraphs. But why does that mean that selection doesn't work?

I have tried putting the h:outputText inside a p:outputPanel, a h:panelGrid and a h:panelGroup but nothing seems to work.

Any help would be greatly appreciated.

Here is the code for my datatable:-

Code: Select all

				<p:dataTable id="productsTable" var="product" value="#{productsBean.products}" 
								rowStyleClass="white" selected="#{productsBean.selectedProduct}" selectionMode="single"
								rowSelectListener="#{productsBean.onRowSelect}" rowUnselectListener="#{productsBean.onRowUnselect}"
								onRowSelectUpdate="productsPanel,confirmMessage" onRowUnselectUpdate="productsPanel,confirmMessage" 
                                selection="#{productsBean.selectedProduct}">
					<p:column headerText="Name">
						<h:outputText value="#{product.name}"/>
					</p:column>
					<p:column headerText="Description">
				        <h:outputText value="#{web:formatParagraphsWithClass(product.description, 'no-padding')}" escape="false"/>
					</p:column>
					<p:column headerText="Task Prefix">
						<h:outputText value="#{product.taskPrefix}"/>
					</p:column>
				</p:dataTable>

garethwebbley
Posts: 23
Joined: 06 Mar 2011, 22:35

18 Apr 2011, 23:06

Sorry should have said I am using Mojarra 2.1.0-b11,Tomcat 6.0.26 and Primefaces 3.0.M1.

garethwebbley
Posts: 23
Joined: 06 Mar 2011, 22:35

19 Apr 2011, 15:36

If you can point me in the right direction I am quite happy to see if I can provide a fix for this myself but I've tried to debug it and can't seem to work it out.

User avatar
undermensch
Posts: 140
Joined: 08 Jul 2010, 14:37
Location: Florida, United States

19 Apr 2011, 19:50

In lieu of calling that function, why not write a custom converter to handle it? Then use

Code: Select all

...<h:outputText value=#{product.description} converter="your.custom.converter" escape="false" />...
PrimeFaces-11.0.6 / Wildfly 24

garethwebbley
Posts: 23
Joined: 06 Mar 2011, 22:35

19 Apr 2011, 22:43

Thanks for the response. I have tried your suggestion but it has the same problem. The column with the converter does not fire the selected/unselected events when clicked.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests