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/23 16:35:18 UTC

[TRINIDAD] Dynamic column groups

Hi all,

I have a number of counters that I want to show as nested columns.  This
will look something like this:

|                  |              Counters                 |
|      Date      |  AA  |  BB  |  CC  |  DD  |  EE  |
|-------------|------------------------------ |
| 22/06/2008  |  0    |   20 |  10  |   0    | 10   |
| 22/06/2008  |  0    |   21 |  12  |   0    | 12   |
| 23/06/2008  |  2    |   23 |  15  |  10   | 10   |
...


In my backing bean I have a List of Objects.  For all objects in my list I
want to show a column , but how do I have to dynamically create group
columns?  I already tried this:

	<tr:table binding="#{backingBean.overviewTable}"
value="#{backingBean.dataModel}" var="row">
		<tr:column headerText="Date">
			<tr:outputText value="#{row.date}" converter="DateConverter"/>
		</tr:column>
		<tr:column headerText="Counters">
			<c:forEach items="#{row.counters}" var="counter">
				<tr:column headerText="#{counter.type.id}">
					<tr:outputText value="#{counter.valueString}"/>
				</c:column>					
			</tr:forEach>			
		</tr:column>					
	</tr:table>

The result of the code above, is an empty column under "Counters".  Can't I
use c:forEach?  Or is there something else wrong?

If I use tr:iterator instead of c:forEach, I get an
IndexOutOfBoundsException (on position 5).  But this is something I don't
get.  This iterator isn't supposed to iterate out of the bounds...  Or is
it?

Using tr:forEach isn't a solution either.  This results in an exception
(noClassDefFoundError  javax/servlet/jsp/jstl/core/IndexedValueExpression )
because it needs the jstl 1.2 library and on this moment I'm only allowed to
use jstl 1.1.2...

Hope someone can help me (or point me to the correct direction) because I'm
searching a couple of days now...  Wish there was an easy solution!

Joris
-- 
View this message in context: http://www.nabble.com/-TRINIDAD--Dynamic-column-groups-tp18070579p18070579.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [TRINIDAD] Dynamic column groups

Posted by Matthias Wessendorf <ma...@apache.org>.
I think one option is to use the <trh:xxx> components, like
layoutTable/cellFormat and use forEach/iterate
to generate those columns.

Greetings,
Matthias

On Tue, Jun 24, 2008 at 5:30 AM, Paul Spencer <pa...@apache.org> wrote:
> Joris,
> I am using the Tomahawk component, <t:columns>, inside a <t:dataTable>.  The
> table is inside a Trinidad component.  I do not know the answer to you
> question.
>
> I suggest you pose the question in a new post with an appropriate subject.
>
> Paul Spencer
>
>
>  Joris Kimpe wrote:
>>
>> Thanks Paul,
>>
>> this seems to be what I need...  However, I implemented it now using a
>> trinidad table.  The Trinidad table has an attribute varStatus.  Is there
>> something simular in the Tobago dataTable?
>>
>> Joris
>>
>>
>>
>> Paul Spencer-3 wrote:
>>>
>>> Joris,
>>> I am doing something similar using <t:columns>.  Their is documentation
>>> on the wiki when this component was in the sandbox [1].
>>>
>>> Paul Spencer
>>>
>>> [1]http://wiki.apache.org/myfaces/Dynamic_Columns?highlight=(columns)
>>>
>>> Joris Kimpe wrote:
>>>>
>>>> Hi all,
>>>>
>>>> I have a number of counters that I want to show as nested columns.  This
>>>> will look something like this:
>>>>
>>>> |                  |              Counters                 |
>>>> |      Date      |  AA  |  BB  |  CC  |  DD  |  EE  |
>>>> |-------------|------------------------------ |
>>>> | 22/06/2008  |  0    |   20 |  10  |   0    | 10   |
>>>> | 22/06/2008  |  0    |   21 |  12  |   0    | 12   |
>>>> | 23/06/2008  |  2    |   23 |  15  |  10   | 10   |
>>>> ...
>>>>
>>>>
>>>> In my backing bean I have a List of Objects.  For all objects in my list
>>>> I
>>>> want to show a column , but how do I have to dynamically create group
>>>> columns?  I already tried this:
>>>>
>>>>        <tr:table binding="#{backingBean.overviewTable}"
>>>> value="#{backingBean.dataModel}" var="row">
>>>>                <tr:column headerText="Date">
>>>>                        <tr:outputText value="#{row.date}"
>>>> converter="DateConverter"/>
>>>>                </tr:column>
>>>>                <tr:column headerText="Counters">
>>>>                        <c:forEach items="#{row.counters}" var="counter">
>>>>                                <tr:column
>>>> headerText="#{counter.type.id}">
>>>>                                        <tr:outputText
>>>> value="#{counter.valueString}"/>
>>>>                                </c:column>
>>>>
>>>>                        </tr:forEach>
>>>>                </tr:column>
>>>>        </tr:table>
>>>>
>>>> The result of the code above, is an empty column under "Counters".
>>>>  Can't
>>>> I
>>>> use c:forEach?  Or is there something else wrong?
>>>>
>>>> If I use tr:iterator instead of c:forEach, I get an
>>>> IndexOutOfBoundsException (on position 5).  But this is something I
>>>> don't
>>>> get.  This iterator isn't supposed to iterate out of the bounds...  Or
>>>> is
>>>> it?
>>>>
>>>> Using tr:forEach isn't a solution either.  This results in an exception
>>>> (noClassDefFoundError
>>>>  javax/servlet/jsp/jstl/core/IndexedValueExpression
>>>> )
>>>> because it needs the jstl 1.2 library and on this moment I'm only
>>>> allowed
>>>> to
>>>> use jstl 1.1.2...
>>>>
>>>> Hope someone can help me (or point me to the correct direction) because
>>>> I'm
>>>> searching a couple of days now...  Wish there was an easy solution!
>>>>
>>>> Joris
>>>
>>>
>>
>
>



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Re: [TRINIDAD] Dynamic column groups

Posted by Paul Spencer <pa...@apache.org>.
Joris,
I am using the Tomahawk component, <t:columns>, inside a <t:dataTable>. 
  The table is inside a Trinidad component.  I do not know the answer to 
you question.

I suggest you pose the question in a new post with an appropriate subject.

Paul Spencer


  Joris Kimpe wrote:
> Thanks Paul,
> 
> this seems to be what I need...  However, I implemented it now using a
> trinidad table.  The Trinidad table has an attribute varStatus.  Is there
> something simular in the Tobago dataTable?
> 
> Joris
> 
> 
> 
> Paul Spencer-3 wrote:
>> Joris,
>> I am doing something similar using <t:columns>.  Their is documentation 
>> on the wiki when this component was in the sandbox [1].
>>
>> Paul Spencer
>>
>> [1]http://wiki.apache.org/myfaces/Dynamic_Columns?highlight=(columns)
>>
>> Joris Kimpe wrote:
>>> Hi all,
>>>
>>> I have a number of counters that I want to show as nested columns.  This
>>> will look something like this:
>>>
>>> |                  |              Counters                 |
>>> |      Date      |  AA  |  BB  |  CC  |  DD  |  EE  |
>>> |-------------|------------------------------ |
>>> | 22/06/2008  |  0    |   20 |  10  |   0    | 10   |
>>> | 22/06/2008  |  0    |   21 |  12  |   0    | 12   |
>>> | 23/06/2008  |  2    |   23 |  15  |  10   | 10   |
>>> ...
>>>
>>>
>>> In my backing bean I have a List of Objects.  For all objects in my list
>>> I
>>> want to show a column , but how do I have to dynamically create group
>>> columns?  I already tried this:
>>>
>>> 	<tr:table binding="#{backingBean.overviewTable}"
>>> value="#{backingBean.dataModel}" var="row">
>>> 		<tr:column headerText="Date">
>>> 			<tr:outputText value="#{row.date}" converter="DateConverter"/>
>>> 		</tr:column>
>>> 		<tr:column headerText="Counters">
>>> 			<c:forEach items="#{row.counters}" var="counter">
>>> 				<tr:column headerText="#{counter.type.id}">
>>> 					<tr:outputText value="#{counter.valueString}"/>
>>> 				</c:column>					
>>> 			</tr:forEach>			
>>> 		</tr:column>					
>>> 	</tr:table>
>>>
>>> The result of the code above, is an empty column under "Counters".  Can't
>>> I
>>> use c:forEach?  Or is there something else wrong?
>>>
>>> If I use tr:iterator instead of c:forEach, I get an
>>> IndexOutOfBoundsException (on position 5).  But this is something I don't
>>> get.  This iterator isn't supposed to iterate out of the bounds...  Or is
>>> it?
>>>
>>> Using tr:forEach isn't a solution either.  This results in an exception
>>> (noClassDefFoundError  javax/servlet/jsp/jstl/core/IndexedValueExpression
>>> )
>>> because it needs the jstl 1.2 library and on this moment I'm only allowed
>>> to
>>> use jstl 1.1.2...
>>>
>>> Hope someone can help me (or point me to the correct direction) because
>>> I'm
>>> searching a couple of days now...  Wish there was an easy solution!
>>>
>>> Joris
>>
>>
> 


Re: [TRINIDAD] Dynamic column groups

Posted by Mike Kienenberger <mk...@gmail.com>.
t:dataTable and t:columns are Tomahawk components, not Tobago ones.

http://myfaces.apache.org/tomahawk/extDataTable.html

Some of what it is available from varStatus is available on the Tomahawk table.

For example, rowIndexVar for varStatus's index.



On 6/24/08, Joris Kimpe <jo...@get.be> wrote:
>
>  Thanks Paul,
>
>  this seems to be what I need...  However, I implemented it now using a
>  trinidad table.  The Trinidad table has an attribute varStatus.  Is there
>  something simular in the Tobago dataTable?
>
>  Joris
>
>
>
>
>  Paul Spencer-3 wrote:
>  >
>  > Joris,
>  > I am doing something similar using <t:columns>.  Their is documentation
>  > on the wiki when this component was in the sandbox [1].
>  >
>  > Paul Spencer
>  >
>  > [1]http://wiki.apache.org/myfaces/Dynamic_Columns?highlight=(columns)
>  >
>  > Joris Kimpe wrote:
>  >> Hi all,
>  >>
>  >> I have a number of counters that I want to show as nested columns.  This
>  >> will look something like this:
>  >>
>  >> |                  |              Counters                 |
>  >> |      Date      |  AA  |  BB  |  CC  |  DD  |  EE  |
>  >> |-------------|------------------------------ |
>  >> | 22/06/2008  |  0    |   20 |  10  |   0    | 10   |
>  >> | 22/06/2008  |  0    |   21 |  12  |   0    | 12   |
>  >> | 23/06/2008  |  2    |   23 |  15  |  10   | 10   |
>  >> ...
>  >>
>  >>
>  >> In my backing bean I have a List of Objects.  For all objects in my list
>  >> I
>  >> want to show a column , but how do I have to dynamically create group
>  >> columns?  I already tried this:
>  >>
>  >>      <tr:table binding="#{backingBean.overviewTable}"
>  >> value="#{backingBean.dataModel}" var="row">
>  >>              <tr:column headerText="Date">
>  >>                      <tr:outputText value="#{row.date}" converter="DateConverter"/>
>  >>              </tr:column>
>  >>              <tr:column headerText="Counters">
>  >>                      <c:forEach items="#{row.counters}" var="counter">
>  >>                              <tr:column headerText="#{counter.type.id}">
>  >>                                      <tr:outputText value="#{counter.valueString}"/>
>  >>                              </c:column>
>  >>                      </tr:forEach>
>  >>              </tr:column>
>  >>      </tr:table>
>  >>
>  >> The result of the code above, is an empty column under "Counters".  Can't
>  >> I
>  >> use c:forEach?  Or is there something else wrong?
>  >>
>  >> If I use tr:iterator instead of c:forEach, I get an
>  >> IndexOutOfBoundsException (on position 5).  But this is something I don't
>  >> get.  This iterator isn't supposed to iterate out of the bounds...  Or is
>  >> it?
>  >>
>  >> Using tr:forEach isn't a solution either.  This results in an exception
>  >> (noClassDefFoundError  javax/servlet/jsp/jstl/core/IndexedValueExpression
>  >> )
>  >> because it needs the jstl 1.2 library and on this moment I'm only allowed
>  >> to
>  >> use jstl 1.1.2...
>  >>
>  >> Hope someone can help me (or point me to the correct direction) because
>  >> I'm
>  >> searching a couple of days now...  Wish there was an easy solution!
>  >>
>  >> Joris
>  >
>  >
>  >
>
>
> --
>  View this message in context: http://www.nabble.com/-TRINIDAD--Dynamic-column-groups-tp18070579p18085105.html
>
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: [TRINIDAD] Dynamic column groups

Posted by dushyant agarwal <ag...@yahoo.co.in>.
Hi Joris,
You could use the backing bean to dynamically create the columns. It had helped me in my project.
In the backing bean you could create a method

createColumn(int numOfCols){
List<UiComponent> tableChildList = table.getChildren();

for(int i=0;i<numOfCols;i++){
CoreColumn newCol= new CoreColumn();
List colChildList = newCol.getChildren();
//set HeaderText for new col
CoreOutputText newText = new CoreOutputText();
// setValue binding of newText
colChildList.add(newText);
 tableChildList.add(newCol);

}
}
cheers......

--- On Tue, 24/6/08, Joris Kimpe <jo...@get.be> wrote:
From: Joris Kimpe <jo...@get.be>
Subject: Re: [TRINIDAD] Dynamic column groups
To: users@myfaces.apache.org
Date: Tuesday, 24 June, 2008, 12:35 PM

Thanks Paul,

this seems to be what I need...  However, I implemented it now using a
trinidad table.  The Trinidad table has an attribute varStatus.  Is there
something simular in the Tobago dataTable?

Joris



Paul Spencer-3 wrote:
> 
> Joris,
> I am doing something similar using <t:columns>.  Their is
documentation 
> on the wiki when this component was in the sandbox [1].
> 
> Paul Spencer
> 
> [1]http://wiki.apache.org/myfaces/Dynamic_Columns?highlight=(columns)
> 
> Joris Kimpe wrote:
>> Hi all,
>> 
>> I have a number of counters that I want to show as nested columns. 
This
>> will look something like this:
>> 
>> |                  |              Counters                 |
>> |      Date      |  AA  |  BB  |  CC  |  DD  |  EE  |
>> |-------------|------------------------------ |
>> | 22/06/2008  |  0    |   20 |  10  |   0    | 10   |
>> | 22/06/2008  |  0    |   21 |  12  |   0    | 12   |
>> | 23/06/2008  |  2    |   23 |  15  |  10   | 10   |
>> ...
>> 
>> 
>> In my backing bean I have a List of Objects.  For all objects in my
list
>> I
>> want to show a column , but how do I have to dynamically create group
>> columns?  I already tried this:
>> 
>> 	<tr:table binding="#{backingBean.overviewTable}"
>> value="#{backingBean.dataModel}" var="row">
>> 		<tr:column headerText="Date">
>> 			<tr:outputText value="#{row.date}"
converter="DateConverter"/>
>> 		</tr:column>
>> 		<tr:column headerText="Counters">
>> 			<c:forEach items="#{row.counters}"
var="counter">
>> 				<tr:column headerText="#{counter.type.id}">
>> 					<tr:outputText value="#{counter.valueString}"/>
>> 				</c:column>					
>> 			</tr:forEach>			
>> 		</tr:column>					
>> 	</tr:table>
>> 
>> The result of the code above, is an empty column under
"Counters".  Can't
>> I
>> use c:forEach?  Or is there something else wrong?
>> 
>> If I use tr:iterator instead of c:forEach, I get an
>> IndexOutOfBoundsException (on position 5).  But this is something I
don't
>> get.  This iterator isn't supposed to iterate out of the bounds...
 Or is
>> it?
>> 
>> Using tr:forEach isn't a solution either.  This results in an
exception
>> (noClassDefFoundError 
javax/servlet/jsp/jstl/core/IndexedValueExpression
>> )
>> because it needs the jstl 1.2 library and on this moment I'm only
allowed
>> to
>> use jstl 1.1.2...
>> 
>> Hope someone can help me (or point me to the correct direction)
because
>> I'm
>> searching a couple of days now...  Wish there was an easy solution!
>> 
>> Joris
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/-TRINIDAD--Dynamic-column-groups-tp18070579p18085105.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


      Meet people who discuss and share your passions. Go to http://in.promos.yahoo.com/groups/bestofyahoo/

Re: [TRINIDAD] Dynamic column groups

Posted by Joris Kimpe <jo...@get.be>.
Thanks Paul,

this seems to be what I need...  However, I implemented it now using a
trinidad table.  The Trinidad table has an attribute varStatus.  Is there
something simular in the Tobago dataTable?

Joris



Paul Spencer-3 wrote:
> 
> Joris,
> I am doing something similar using <t:columns>.  Their is documentation 
> on the wiki when this component was in the sandbox [1].
> 
> Paul Spencer
> 
> [1]http://wiki.apache.org/myfaces/Dynamic_Columns?highlight=(columns)
> 
> Joris Kimpe wrote:
>> Hi all,
>> 
>> I have a number of counters that I want to show as nested columns.  This
>> will look something like this:
>> 
>> |                  |              Counters                 |
>> |      Date      |  AA  |  BB  |  CC  |  DD  |  EE  |
>> |-------------|------------------------------ |
>> | 22/06/2008  |  0    |   20 |  10  |   0    | 10   |
>> | 22/06/2008  |  0    |   21 |  12  |   0    | 12   |
>> | 23/06/2008  |  2    |   23 |  15  |  10   | 10   |
>> ...
>> 
>> 
>> In my backing bean I have a List of Objects.  For all objects in my list
>> I
>> want to show a column , but how do I have to dynamically create group
>> columns?  I already tried this:
>> 
>> 	<tr:table binding="#{backingBean.overviewTable}"
>> value="#{backingBean.dataModel}" var="row">
>> 		<tr:column headerText="Date">
>> 			<tr:outputText value="#{row.date}" converter="DateConverter"/>
>> 		</tr:column>
>> 		<tr:column headerText="Counters">
>> 			<c:forEach items="#{row.counters}" var="counter">
>> 				<tr:column headerText="#{counter.type.id}">
>> 					<tr:outputText value="#{counter.valueString}"/>
>> 				</c:column>					
>> 			</tr:forEach>			
>> 		</tr:column>					
>> 	</tr:table>
>> 
>> The result of the code above, is an empty column under "Counters".  Can't
>> I
>> use c:forEach?  Or is there something else wrong?
>> 
>> If I use tr:iterator instead of c:forEach, I get an
>> IndexOutOfBoundsException (on position 5).  But this is something I don't
>> get.  This iterator isn't supposed to iterate out of the bounds...  Or is
>> it?
>> 
>> Using tr:forEach isn't a solution either.  This results in an exception
>> (noClassDefFoundError  javax/servlet/jsp/jstl/core/IndexedValueExpression
>> )
>> because it needs the jstl 1.2 library and on this moment I'm only allowed
>> to
>> use jstl 1.1.2...
>> 
>> Hope someone can help me (or point me to the correct direction) because
>> I'm
>> searching a couple of days now...  Wish there was an easy solution!
>> 
>> Joris
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-TRINIDAD--Dynamic-column-groups-tp18070579p18085105.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [TRINIDAD] Dynamic column groups

Posted by Paul Spencer <pa...@apache.org>.
Joris,
I am doing something similar using <t:columns>.  Their is documentation 
on the wiki when this component was in the sandbox [1].

Paul Spencer

[1]http://wiki.apache.org/myfaces/Dynamic_Columns?highlight=(columns)

Joris Kimpe wrote:
> Hi all,
> 
> I have a number of counters that I want to show as nested columns.  This
> will look something like this:
> 
> |                  |              Counters                 |
> |      Date      |  AA  |  BB  |  CC  |  DD  |  EE  |
> |-------------|------------------------------ |
> | 22/06/2008  |  0    |   20 |  10  |   0    | 10   |
> | 22/06/2008  |  0    |   21 |  12  |   0    | 12   |
> | 23/06/2008  |  2    |   23 |  15  |  10   | 10   |
> ...
> 
> 
> In my backing bean I have a List of Objects.  For all objects in my list I
> want to show a column , but how do I have to dynamically create group
> columns?  I already tried this:
> 
> 	<tr:table binding="#{backingBean.overviewTable}"
> value="#{backingBean.dataModel}" var="row">
> 		<tr:column headerText="Date">
> 			<tr:outputText value="#{row.date}" converter="DateConverter"/>
> 		</tr:column>
> 		<tr:column headerText="Counters">
> 			<c:forEach items="#{row.counters}" var="counter">
> 				<tr:column headerText="#{counter.type.id}">
> 					<tr:outputText value="#{counter.valueString}"/>
> 				</c:column>					
> 			</tr:forEach>			
> 		</tr:column>					
> 	</tr:table>
> 
> The result of the code above, is an empty column under "Counters".  Can't I
> use c:forEach?  Or is there something else wrong?
> 
> If I use tr:iterator instead of c:forEach, I get an
> IndexOutOfBoundsException (on position 5).  But this is something I don't
> get.  This iterator isn't supposed to iterate out of the bounds...  Or is
> it?
> 
> Using tr:forEach isn't a solution either.  This results in an exception
> (noClassDefFoundError  javax/servlet/jsp/jstl/core/IndexedValueExpression )
> because it needs the jstl 1.2 library and on this moment I'm only allowed to
> use jstl 1.1.2...
> 
> Hope someone can help me (or point me to the correct direction) because I'm
> searching a couple of days now...  Wish there was an easy solution!
> 
> Joris