4

I have a master detail resultset that I present on a datatable.

The detail is fetched and rendered within to be combined into a single output string that remains in one column.

<p:column>
  <f:facet name="header">BF Order Contents</f:facet>
  <ui:repeat value="#{order.listOfOrderDetails}" var="orderitem" varStatus="orderitemstatus" >
    <h:outputText value="#{orderitem.product.brand.name}-#{orderitem.product.name}#{orderitemstatus.last ? '':', '}" />
  </ui:repeat>
</p:column>

On the datatable, that column displays as "Some Brand-Some Product, Other Brand-Other Product"

But when I export to EXCEL, I see:

com.sun.faces.facelets.component.UIRepeat@783622ba

in that column.

Does anyone have any idea about how I can overcome this (within xhtml only). I don't want to alter the backing bean to produce the detail string.

BTW: I'm on PF3.2, Mojarra 2.1.8, EL 2.2.1-b04, JDK1.7, Tomcat7

Thanks

Serkan Durusoy
  • 5,447
  • 2
  • 20
  • 39

3 Answers3

5

It can be solved in the below manner.

  1. Column having ui:repeat should not be made exportable i.e set exportable="false" attribute for p:column.
  2. Add one more column to display the string property (write bussiness logic to convert list of string to a comma seperated string and set it the string property)
  3. set the style as display:none; for the new column.
  4. so during ui display, the previous column will display and during export the new column will be displayed showing comma seperated list.
user3819259
  • 95
  • 1
  • 9
0

I really don't think its possible , even with overriding the exporter class in the primefaces sources it will be way to complicated...

You probably better alter the backing bean

Also, you can add a star on a bit related an issue opened by me Feature request: Datatables custom filter function - filterFunction (like sortFunction for sort)

Daniel
  • 36,833
  • 10
  • 119
  • 200
0

You can write a facelet function that does the iteration in Java and returns a string.. this will work just put it to outputText, or do 2 columns one put exportable false and the other make CSS display:none

TomCe
  • 9
  • 3