In p:dataTable, if we need to add List of values (List<String>) we can use another p:dataTable oppose to p:subTable. Although this workaround is worked, we need to do some adjustments to add scroll bars to the sub table. Below is the prime face source.
Check the div tags and styles use to get the scroll bar. In this case we didn't use prime face scrollerble property.
Source:
Output:
Google Analytics
Tuesday, May 10, 2016
Jasper Reports - Customized field values for List
Jasper supports List of values in a single field. However jasper prints List<String> as below format.
(Jasper List of Values) Presentation
Print format of the Jasper - [aaa,bbb,ccc].
If you want to print above value line by line with additional horizontal dash line, you can modify your .jrxml field as below.
From java side field value sends :
List<String> xxx = new List<String>;
String d = "xx1"+"("+"ssss"+")"+ "-"+Date+"/"+"OOO";
String e = "xx2"+"("+"vvvv"+")"+ "-"+Date+"/"+"HHH";
String f = "xx3"+"("+"hhhh"+")"+ "-"+Date+"/"+"KKK";
xxx.add(d);
xxx.add(e);
xxx.add(f);
--------------------------------------------------------------------------------------------
In Jrxml
($F{xxx}.substring(1, $F{xxx}.length() - 1 )).replaceAll( ",", System.getProperty("line.separator")+"-----------------------------------------------"+ System.getProperty("line.separator"))
-------------------------------------------------------------------------------------------------
Out put:
xx1 (ssss) - 03/11/2015 / OOO
-----------------------------------------------
xx2 (vvvv) - 05/10/2015 / HHH
-----------------------------------------------
xx3 (hhhh) - 02/08/2015 / KKK
(Jasper List of Values) Presentation
Print format of the Jasper - [aaa,bbb,ccc].
If you want to print above value line by line with additional horizontal dash line, you can modify your .jrxml field as below.
From java side field value sends :
List<String> xxx = new List<String>;
String d = "xx1"+"("+"ssss"+")"+ "-"+Date+"/"+"OOO";
String e = "xx2"+"("+"vvvv"+")"+ "-"+Date+"/"+"HHH";
String f = "xx3"+"("+"hhhh"+")"+ "-"+Date+"/"+"KKK";
xxx.add(d);
xxx.add(e);
xxx.add(f);
--------------------------------------------------------------------------------------------
In Jrxml
($F{xxx}.substring(1, $F{xxx}.length() - 1 )).replaceAll( ",", System.getProperty("line.separator")+"-----------------------------------------------"+ System.getProperty("line.separator"))
-------------------------------------------------------------------------------------------------
Out put:
xx1 (ssss) - 03/11/2015 / OOO
-----------------------------------------------
xx2 (vvvv) - 05/10/2015 / HHH
-----------------------------------------------
xx3 (hhhh) - 02/08/2015 / KKK
Subscribe to:
Posts (Atom)