You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Joris Kimpe <jo...@get.be> on 2008/06/19 17:19:29 UTC

[TRINIDAD] table header with rowspan (and multiple lines)

Hi all,

I now have a table containing another table in one of my columns.  It looks
something like this:

|      Date       |        Counters            |
---------------------------------------
|  19/06/2008  |   |   Id    |   value   |  |
|                   |   -------------------  |
|                   |   |   AA   |   00:00   |  | 
|                   |   |   BB   |   01:00   |  |
----------------------------------------


Which I implemented like this:
	<tr:table id="overview" value="#{backingBean.dataModel}" var="row">
		<tr:column>
			<f:facet name="header">
				<tr:outputText value="Date"/>
			</f:facet>
			<tr:outputText value="#{row.date}"/>
		</tr:column>
		<tr:column>
			<f:facet name="header">
				<tr:outputText value="Counters" />
			</f:facet>
			<tr:panelFormLayout>
				<tr:table id="counters" value="#{row.counters}" var="counter">
					<tr:column>
						<tr:outputLabel value="#{counter.type.id}"/>
					</tr:column>
					<tr:column>
						<tr:outputLabel value="#{counter.value}"/>
					</tr:column>					
				</tr:table>
			</tr:panelFormLayout>			
		</tr:column>					
	</tr:table>



Now I want to change my table to something like this:
---------------------------------------
|                   |        Counters           |
|      Date       |      AA     |      BB     |
---------------------------------------
|  19/06/2008  |    00:00   |    01:00   |
----------------------------------------


How can I do this?  Do I have to rewrite this by using tr:iterator,
trh:rowLayout and trh:cellFormat?  Or can I do this easily by adapting my
existing code?

Thanks!

Joris


-- 
View this message in context: http://www.nabble.com/-TRINIDAD--table-header-with-rowspan-%28and-multiple-lines%29-tp18011285p18011285.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [TRINIDAD] table header with rowspan (and multiple lines)

Posted by Joris Kimpe <jo...@get.be>.
I already tried to do this...  When I use c:forEach, the result is an empty
column (so the nested columns aren't rendered).

    <tr:column width="20%"
headerText="#{text['calculationOverview.counters']}">
        <c:forEach items="#{row.counters}" var="counter">
            <tr:column headerText="#{counter.type.id}">
                <tr:outputText value="#{counter.valueString}"/>
            </tr:column>			
        </c:forEach>			
    </tr:column>


Joris



Glauco P. Gomes wrote:
> 
> I haven't did this (dinamically nested columns) but If you are using 
> facelets or JSF 1.2 try using c:forEach and post the results, maybe this 
> solve your issue.
> 
> Glauco P. Gomes
> 
> Joris Kimpe escreveu:
>> This is indeed what I want to do.  However, I need to have data in one
>> column
>> ("counters") that is a List of data of my var.  So I try to iterate this
>> list...  which results in an exception:
>>
>> 	java.lang.IndexOutOfBoundsException: Index: 5, Size: 5
>> 	at java.util.ArrayList.RangeCheck(Unknown Source)
>> 	at java.util.ArrayList.get(Unknown Source)
>> 	at
>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.ColumnData._get(ColumnData.java:431)
>> 	at
>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.ColumnData.useSeparateRows(ColumnData.java:284)
>> 	at
>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ColumnRenderer._renderDataMode(ColumnRenderer.java:213)
>> 	at
>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ColumnRenderer.encodeAll(ColumnRenderer.java:96)
>> 	at
>> org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:224)
>> 	...
>>
>>
>> This is what I did:
>> <tr:table id="overview" value="#{backingBean.dataModel}" var="row">
>> 	<tr:column>
>> 		<f:facet name="header">
>> 			<tr:outputText value="Date"/>
>> 		</f:facet>
>> 		<tr:outputText value="#{row.date}"/>
>> 	</tr:column> 
>> 	<tr:column width="20%" headerText="Counters">
>> 		<tr:column>
>> 			<tr:iterator value="#{row.counters}" var="counter">				
>> 				<tr:column headerText="id">
>> 					<tr:outputLabel value="#{counter.valueString}"/>
>> 				</tr:column>
>> 			</tr:iterator>
>> 		</tr:column>
>> 	</tr:column>
>>
>>
>>
>>
>> Glauco P. Gomes wrote:
>>   
>>> You can use nested columns, for details search for "Column Groups" in 
>>> the tag documentation[1] and in the developer guide[2].
>>>
>>> [1]
>>> http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_column.html
>>> [2] http://myfaces.apache.org/trinidad/devguide/table.html
>>>
>>> Glauco P. Gomes
> 
> 

-- 
View this message in context: http://www.nabble.com/-TRINIDAD--table-header-with-rowspan-%28and-multiple-lines%29-tp18011285p18027941.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [TRINIDAD] table header with rowspan (and multiple lines)

Posted by "Glauco P. Gomes" <gl...@yahoo.com.br>.
I haven't did this (dinamically nested columns) but If you are using 
facelets or JSF 1.2 try using c:forEach and post the results, maybe this 
solve your issue.

Glauco P. Gomes

Joris Kimpe escreveu:
> This is indeed what I want to do.  However, I need to have data in one column
> ("counters") that is a List of data of my var.  So I try to iterate this
> list...  which results in an exception:
>
> 	java.lang.IndexOutOfBoundsException: Index: 5, Size: 5
> 	at java.util.ArrayList.RangeCheck(Unknown Source)
> 	at java.util.ArrayList.get(Unknown Source)
> 	at
> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.ColumnData._get(ColumnData.java:431)
> 	at
> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.ColumnData.useSeparateRows(ColumnData.java:284)
> 	at
> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ColumnRenderer._renderDataMode(ColumnRenderer.java:213)
> 	at
> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ColumnRenderer.encodeAll(ColumnRenderer.java:96)
> 	at
> org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:224)
> 	...
>
>
> This is what I did:
> <tr:table id="overview" value="#{backingBean.dataModel}" var="row">
> 	<tr:column>
> 		<f:facet name="header">
> 			<tr:outputText value="Date"/>
> 		</f:facet>
> 		<tr:outputText value="#{row.date}"/>
> 	</tr:column> 
> 	<tr:column width="20%" headerText="Counters">
> 		<tr:column>
> 			<tr:iterator value="#{row.counters}" var="counter">				
> 				<tr:column headerText="id">
> 					<tr:outputLabel value="#{counter.valueString}"/>
> 				</tr:column>
> 			</tr:iterator>
> 		</tr:column>
> 	</tr:column>
>
>
>
>
> Glauco P. Gomes wrote:
>   
>> You can use nested columns, for details search for "Column Groups" in 
>> the tag documentation[1] and in the developer guide[2].
>>
>> [1] http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_column.html
>> [2] http://myfaces.apache.org/trinidad/devguide/table.html
>>
>> Glauco P. Gomes

Re: [TRINIDAD] table header with rowspan (and multiple lines)

Posted by Joris Kimpe <jo...@get.be>.
This is indeed what I want to do.  However, I need to have data in one column
("counters") that is a List of data of my var.  So I try to iterate this
list...  which results in an exception:

	java.lang.IndexOutOfBoundsException: Index: 5, Size: 5
	at java.util.ArrayList.RangeCheck(Unknown Source)
	at java.util.ArrayList.get(Unknown Source)
	at
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.ColumnData._get(ColumnData.java:431)
	at
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.ColumnData.useSeparateRows(ColumnData.java:284)
	at
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ColumnRenderer._renderDataMode(ColumnRenderer.java:213)
	at
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ColumnRenderer.encodeAll(ColumnRenderer.java:96)
	at
org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:224)
	...


This is what I did:
<tr:table id="overview" value="#{backingBean.dataModel}" var="row">
	<tr:column>
		<f:facet name="header">
			<tr:outputText value="Date"/>
		</f:facet>
		<tr:outputText value="#{row.date}"/>
	</tr:column> 
	<tr:column width="20%" headerText="Counters">
		<tr:column>
			<tr:iterator value="#{row.counters}" var="counter">				
				<tr:column headerText="id">
					<tr:outputLabel value="#{counter.valueString}"/>
				</tr:column>
			</tr:iterator>
		</tr:column>
	</tr:column>




Glauco P. Gomes wrote:
> 
> You can use nested columns, for details search for "Column Groups" in 
> the tag documentation[1] and in the developer guide[2].
> 
> [1] http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_column.html
> [2] http://myfaces.apache.org/trinidad/devguide/table.html
> 
> Glauco P. Gomes
> 
> Joris Kimpe escreveu:
>> Hi all,
>>
>> I now have a table containing another table in one of my columns.  It
>> looks
>> something like this:
>>
>> |      Date       |        Counters            |
>> ---------------------------------------
>> |  19/06/2008  |  |   AA   |   00:00   |  | 
>> |                   |   |   BB   |   01:00   |  |
>> ----------------------------------------
>>
>>
>> Which I implemented like this:
>> 	<tr:table id="overview" value="#{backingBean.dataModel}" var="row">
>> 		<tr:column>
>> 			<f:facet name="header">
>> 				<tr:outputText value="Date"/>
>> 			</f:facet>
>> 			<tr:outputText value="#{row.date}"/>
>> 		</tr:column>
>> 		<tr:column>
>> 			<f:facet name="header">
>> 				<tr:outputText value="Counters" />
>> 			</f:facet>
>> 			<tr:panelFormLayout>
>> 				<tr:table id="counters" value="#{row.counters}" var="counter">
>> 					<tr:column>
>> 						<tr:outputLabel value="#{counter.type.id}"/>
>> 					</tr:column>
>> 					<tr:column>
>> 						<tr:outputLabel value="#{counter.value}"/>
>> 					</tr:column>					
>> 				</tr:table>
>> 			</tr:panelFormLayout>			
>> 		</tr:column>					
>> 	</tr:table>
>>
>>
>>
>> Now I want to change my table to something like this:
>> ---------------------------------------
>> |                   |        Counters           |
>> |      Date       |      AA     |      BB     |
>> ---------------------------------------
>> |  19/06/2008  |    00:00   |    01:00   |
>> ----------------------------------------
>>
>>
>> How can I do this?  Do I have to rewrite this by using tr:iterator,
>> trh:rowLayout and trh:cellFormat?  Or can I do this easily by adapting my
>> existing code?
>>
>> Thanks!
>>
>> Joris
>>
>>
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-TRINIDAD--table-header-with-rowspan-%28and-multiple-lines%29-tp18011285p18024364.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [TRINIDAD] table header with rowspan (and multiple lines)

Posted by "Glauco P. Gomes" <gl...@yahoo.com.br>.
You can use nested columns, for details search for "Column Groups" in 
the tag documentation[1] and in the developer guide[2].

[1] http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_column.html
[2] http://myfaces.apache.org/trinidad/devguide/table.html

Glauco P. Gomes

Joris Kimpe escreveu:
> Hi all,
>
> I now have a table containing another table in one of my columns.  It looks
> something like this:
>
> |      Date       |        Counters            |
> ---------------------------------------
> |  19/06/2008  |  |   AA   |   00:00   |  | 
> |                   |   |   BB   |   01:00   |  |
> ----------------------------------------
>
>
> Which I implemented like this:
> 	<tr:table id="overview" value="#{backingBean.dataModel}" var="row">
> 		<tr:column>
> 			<f:facet name="header">
> 				<tr:outputText value="Date"/>
> 			</f:facet>
> 			<tr:outputText value="#{row.date}"/>
> 		</tr:column>
> 		<tr:column>
> 			<f:facet name="header">
> 				<tr:outputText value="Counters" />
> 			</f:facet>
> 			<tr:panelFormLayout>
> 				<tr:table id="counters" value="#{row.counters}" var="counter">
> 					<tr:column>
> 						<tr:outputLabel value="#{counter.type.id}"/>
> 					</tr:column>
> 					<tr:column>
> 						<tr:outputLabel value="#{counter.value}"/>
> 					</tr:column>					
> 				</tr:table>
> 			</tr:panelFormLayout>			
> 		</tr:column>					
> 	</tr:table>
>
>
>
> Now I want to change my table to something like this:
> ---------------------------------------
> |                   |        Counters           |
> |      Date       |      AA     |      BB     |
> ---------------------------------------
> |  19/06/2008  |    00:00   |    01:00   |
> ----------------------------------------
>
>
> How can I do this?  Do I have to rewrite this by using tr:iterator,
> trh:rowLayout and trh:cellFormat?  Or can I do this easily by adapting my
> existing code?
>
> Thanks!
>
> Joris
>
>
>