-
1. How to iterate a List<List<String>> uisng rich:dataTable component
ilya_shaikovsky Mar 17, 2011 4:01 AM (in response to sri_kanthu)in case of nested lists you could use rich:dataTable to iterate over the top level list and rich:collapsibleSubtable(RF 4) or rich:subTable(RF 3) to iterate over sublist.
-
2. How to iterate a List<List<String>> uisng rich:dataTable component
sri_kanthu Mar 17, 2011 6:58 AM (in response to ilya_shaikovsky)thankx Ilya Shaikovsky for your reply!
I have implemented what you suggested,but the desired output is not coming. See the below code image:
here sourceHeaderList in sessionScope contains the following List<List<String>> values:
[[RequestId, Name, Dob,SSN.MRN], [mothername,fatherName,spousename], [Address, HouseNo, City, State, Country, Pincode], [PhoneNo, Fax], [EmailId]]
By using the above code I am displaying like below:
As per my observation the subtable contents are displaying vertically but i need all subtables horizontally like below:
how to achieve this?
-
3. Re: How to iterate a List<List<String>> uisng rich:dataTable component
ilya_shaikovsky Mar 17, 2011 7:23 AM (in response to sri_kanthu)at first subtable should be outside of the column. But anyway - leave that approach I was slightly mistaken.
use rich:columns instead of subtable to generate columns dynamically in a row.
-
4. How to iterate a List<List<String>> uisng rich:dataTable component
sri_kanthu Mar 17, 2011 8:09 AM (in response to ilya_shaikovsky)Can you provide with a small example of iterating nested lists using rich:columns.
i have cahnged the code from rich:subTable to rich:columns like below:
<h:outputLabel value="Customer Source Demographics:" styleClass="outputLabel_head" />
<rich:dataTable value="#{sessionScope.sourceHeaderList}" var="srcHeaderNamesList" >
<rich:columns value="#{srcHeaderNamesList}" var="srcHeaderNames">
<h:outputText value="#{srcHeaderNames}" />
</rich:columns>
</rich:dataTable>
I am getting the below Exception:
SEVERE: FOREACH_BAD_ITEMS
javax.servlet.jsp.JspTagException: FOREACH_BAD_ITEMS
at org.richfaces.iterator.SimpleForEachIterator.toForEachIterator(SimpleForEachIterator.java:135)
at org.richfaces.iterator.SimpleForEachIterator.supportedTypeForEachIterator(SimpleForEachIterator.java:98)
at org.richfaces.taglib.ColumnsHandler.prepare(ColumnsHandler.java:304)
at org.richfaces.taglib.ColumnsHandler.apply(ColumnsHandler.java:489)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
-
5. How to iterate a List<List<String>> uisng rich:dataTable component
nbelaevski Mar 17, 2011 2:15 PM (in response to sri_kanthu)Hi,
Does the nested list have fixed size?
-
6. How to iterate a List<List<String>> uisng rich:dataTable component
sri_kanthu Mar 21, 2011 12:25 AM (in response to nbelaevski)hi,
Sorry for late replying I was out of station for couple of days.
Nested list does not have fixed size. The size changes dynamically.
-
7. How to iterate a List<List<String>> uisng rich:dataTable component
nbelaevski Mar 21, 2011 5:15 AM (in response to sri_kanthu)Data table is required to have the same number of columns for every row (you can use colspans and rowspans, but that's not the case). Try another iteration component, like data grid with nested repeat.
-
8. How to iterate a List<List<String>> uisng rich:dataTable component
sri_kanthu Mar 21, 2011 7:37 AM (in response to nbelaevski)hi ,
i tried with rich:dataGrid component but the desired output is not coming. See the below code:
<rich:dataGrid value="#{sessionScope.sourceHeaderList}" var="srcHeaderNamesList" >
<h:outputText value="#{srcHeaderNamesList}"/>
</rich:dataGrid>
When i ran the code the ouput looks like below:
In the above we can see the dataGrid iterating the subList and displaying the the sublist contents horizontally as a list. If i write another dataGrid inside parent dataGrid the display will be like each vertically separated dataGrid. But my desired output is like the one in above image (as Customer Target Demographics which achieved by using c:forEach and normal HTML Table Element).
How can we achieve the above table like display using dataGrid? Am i missing any attribute?
-
9. How to iterate a List<List<String>> uisng rich:dataTable component
nbelaevski Mar 21, 2011 8:20 AM (in response to sri_kanthu)Try with nested repeat instead.
-
10. How to iterate a List<List<String>> uisng rich:dataTable component
sri_kanthu Mar 22, 2011 12:21 AM (in response to nbelaevski)nested repeat means?
-
11. How to iterate a List<List<String>> uisng rich:dataTable component
ilya_shaikovsky Mar 22, 2011 4:09 AM (in response to sri_kanthu)<a:repeat value="#{bean.parentList}" var="list">
<a:repeat value="#{list.innerList}">
<!--content-->
</a:repeat>
</a:repeat>