myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven Haiges <sven.hai...@web.de>
Subject Re: PanelGrid with dynamic amount of items
Date Tue, 01 Nov 2005 13:37:47 GMT
thanx! i first wanted to try out the programmatic way. I bound a 
panelGrid to a managed bean property and once I get the result from the 
db, I add some outputText elements. the outputText is then added to the 
parent, I simply call setParent(productPanel) - productPanel is the 
panelGrid.

	private HtmlPanelGrid productPanel = new HtmlPanelGrid();

....

		if (result != null) {
			log.debug("Rebuilding productPanel...");
			//this.queryResults = new ListDataModel(result);
			for (Iterator i = result.iterator(); i.hasNext();){
				log.debug("Adding outputtext to panelgrid... ");
				Product product = (Product)i.next();
				HtmlOutputText text = new HtmlOutputText();
				text.setValue(product.getOrderNumber());
				text.setParent(this.productPanel);
			}


I get the log output that some components were created, but nothing is 
shown when the page is rendered. Somehow the panelGrid is empty.... so 
is it actually impossible to add elements with a method like 
panelGrid.addChildComponent(UIComponent...)??

Hmmm. If this does not work for some reason, I guess the only solution 
is to take a look at t:columns. I looked at the example but if I got it 
right, a column with column data of a database table was added. What I 
want is the behaviour of a panelGrid, e.g. items are filled into a 
table from left to right and top-down.

So if I got 6 products returned from the database, this should be 
rendered:

1 | 2 | 3 | 4
5 | 6

Any ideas?

Cheers,
Sven

Am 01.11.2005 um 13:23 Uhr schrieb Martin Marinschek:

> Best is you look into the examples - there you'll find a nice example
> for the dataTable.
>
> link to see it in action: 
> http://www.irian.at/myfaces/crossDataTable.jsf
>
> regards,
>
> Martin
>
> On 11/1/05, Sven Haiges <sven.haiges@web.de> wrote:
>> Ok, so t:columns (not in 1.1 RI, right, only Tomahawk) is used within 
>> a
>> <h:dataTable .. >
>>
>> Where can I find some more info about this tag - the tlddoc is pretty
>> empty... :-)
>>
>> value of t:columns seems to take a datamodel (the same like for the
>> dataTable??)
>> var is the individual item (again duplication, already set in
>> dataTable...)
>>
>> how is the amount of columns specified....?
>>
>> Thanx!
>> Sven
>>
>>
>>
>> Am 01.11.2005 um 13:08 Uhr schrieb Martin Marinschek:
>>
>>> Look at what the dynamic dataTable does - with this and the h:columns
>>> tag, you can arrange things horizontally as well.
>>>
>>> regards,
>>>
>>> Martin
>>>
>>> On 11/1/05, Sven Haiges <sven.haiges@web.de> wrote:
>>>> The problem with dataTable is that the results are displayed
>>>> vertically, so I can display rows of information.
>>>>
>>>> What I want to do is to present the data in a 4*x table, each cell
>>>> should contain the next element. I will use it as an overview 
>>>> results
>>>> page, then the user will be able to click on one cell (image inside)
>>>> and have the detailed view.
>>>>
>>>> I know, very easy with dataTable... or can I switch dataTable and
>>>> display 1 item each row?
>>>>
>>>> cheers\
>>>> sven
>>>>
>>>>
>>>> Am 01.11.2005 um 12:49 Uhr schrieb Martin Marinschek:
>>>>
>>>>> Why don't you use a dataTable for this?
>>>>>
>>>>> regards,
>>>>>
>>>>> Martin
>>>>>
>>>>> On 11/1/05, Sven Haiges <sven.haiges@web.de> wrote:
>>>>>> Hi there,
>>>>>>
>>>>>> I would like to render a panelGrid with an dynamic amount of items
>>>>>> in
>>>>>> it. The items should be bound to a managed bean variable and based
>>>>>> on
>>>>>> the database result, the display should adapt.
>>>>>>
>>>>>> PanelGrid worked fine with a static number of items, but how can
I
>>>>>> add
>>>>>> a dynamic number of items. I know there are problems with 
>>>>>> c:forEach,
>>>>>> that's probably why the example of my code below also does not
>>>>>> work....
>>>>>>
>>>>>>
>>>>>> Any help is appreciated!
>>>>>>
>>>>>> (one sec: I just got the idea to add the components on the server
>>>>>> side,
>>>>>> ok, but isn't there an easy solution that i can just do in my jsp
>>>>>> page?)
>>>>>>
>>>>>> Cheers,
>>>>>> Sven
>>>>>>
>>>>>>         <h:panelGrid columns="4" frame="border">
>>>>>>
>>>>>>                 <c:forEach var='product'
>>>>>> items='#{productSearchBean.queryResults}'>
>>>>>>                                 <h:outputText
>>>>>> styleClass="contentRight"
>>>>>> value="#{product.orderNumber}"/>        <f:verbatim> - 
>>>>>> </f:verbatim>
>>>>>>                                 <h:outputText
>>>>>> styleClass="contentRight"
>>>>>> value="#{product.description.titleEN}"
>>>>>> rendered="#{view.locale.language
>>>>>> eq 'en'}" />
>>>>>>                                 <h:outputText
>>>>>> styleClass="contentRight"
>>>>>> value="#{product.description.titleDE}"
>>>>>> rendered="#{view.locale.language
>>>>>> eq 'de'}" />
>>>>>>                                 <h:outputText
>>>>>> styleClass="contentRight"
>>>>>> value="#{product.description.titleFR}"
>>>>>> rendered="#{view.locale.language
>>>>>> eq 'fr'}" />
>>>>>>                                 <h:outputText
>>>>>> styleClass="contentRight"
>>>>>> value="#{product.description.titleES}"
>>>>>> rendered="#{view.locale.language
>>>>>> eq 'es'}" />
>>>>>>                 </c:forEach>
>>>>>>
>>>>>>         </h:panelGrid>
>>>>>> ---
>>>>>> Sven Haiges
>>>>>> sven.haiges@gmx.de
>>>>>>
>>>>>> TEL +49 89 420 958 993
>>>>>> SIP 8008878@sipgate.de
>>>>>> ---
>>>>>> Sven Haiges
>>>>>> sven.haiges@gmx.de
>>>>>>
>>>>>> TEL +49 89 420 958 993
>>>>>> SIP 8008878@sipgate.de
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> http://www.irian.at
>>>>> Your JSF powerhouse -
>>>>> JSF Trainings in English and German
>>>>>
>>>> ---
>>>> Sven Haiges
>>>> sven.haiges@gmx.de
>>>>
>>>> TEL +49 89 420 958 993
>>>> SIP 8008878@sipgate.de
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> http://www.irian.at
>>> Your JSF powerhouse -
>>> JSF Trainings in English and German
>>>
>> ---
>> Sven Haiges
>> sven.haiges@gmx.de
>>
>> TEL +49 89 420 958 993
>> SIP 8008878@sipgate.de
>>
>>
>
>
> --
>
> http://www.irian.at
> Your JSF powerhouse -
> JSF Trainings in English and German
>
---
Sven Haiges
sven.haiges@gmx.de

TEL +49 89 420 958 993
SIP 8008878@sipgate.de

Mime
View raw message