rich:columns doubt
jgromero Feb 25, 2011 9:19 AMHi
I´m just starting with richfaces... by the way, beautiful job!
I've been searching for several hours the right way to use rich:columns, but I just don't get what I'm doing wrong. Here's the case:
<rich:dataTable value="#{listHistResults.resultArea}" var="result" width="500">
<rich:columns value="#{listHistResults.areas}" var="area">
<f:facet name="header">
<h:outputText value="#{area}" />
</f:facet>
<h:outputText value="#{result} " />
</rich:columns>
</rich:dataTable>
As you can see this is something really simple.
resultArea is an ArrayList of String. area is another an ArrayList of String.
In an example run I obtain:
area 1 | area 2 | area 3 |
---|---|---|
result1 | result1 | result1 |
result2 | result2 | result2 |
result3 | result3 | result3 |
Reading I believed that the right way could be:
<rich:dataTable value="#{listHistResults.resultArea}" var="result" width="500">
<rich:columns value="#{listHistResults.areas}" var="area" index="ind" id="area#{ind}">
<f:facet name="header">
<h:outputText value="#{area}" />
</f:facet>
<h:outputText value="#{result[ind]} " />
</rich:columns>
</rich:dataTable>
but obviously when try to iterate through result it gives me an exception, with the message:
The class 'java.lang.String' does not have the property '0'
So, believing I finally understands it, I try declaring resultArea as an ArrayList of an ArrayList of String, but I obtained:
area 1 | area 2 | area 3 |
---|---|---|
result1 | ||
result2 | ||
result3 |
What I'm looking for here is a one line table.
I'm sure I haven't been able to understand something, but I just don't get what is it, and that's why I ask here for some guidance.
On the other hand, I'm not sure but the url which explains rich:columns have some mistakes?. I mean, in subsection 6.6.3.3, the explanations mention the attributes "begin", "end" among others that are not used in the example.
http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/rich_columns.html
Finally, surfing the svn repository, looking for the source of the demo, I didn´t found anything related to the example of types and models of cars in
I mean, the java source, because in the page there's the source of the page.
Thanks in advance for reading my post, and for any help you can give me.
Juan Romero