myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mathias Brökelmann <mbroekelm...@googlemail.com>
Subject Re: datatable - parameter passing - workaround?
Date Mon, 12 Dec 2005 14:38:53 GMT
use an instance of javax.faces.model.DataModel for the datatable´s
value. You can then use datamodel.getRowIndex() or
datamodel.getRowData() to get the current row value during the
iteration.

2005/12/12, Harald Müller <harald.mueller@wimaxtelecom.at>:
> Hi!
>
> My current (test)code to create a datatable in a dynamic created tab looks like this:
>
>
>       // datatable
>       UIData hdt = (HtmlDataTable)app.createComponent(HtmlDataTable.COMPONENT_TYPE);
>       hdt.setId("hdtId1");
>       hdt.setVar("hdtVar1");
>       tab.getChildren().add(hdt);
>
>       List content = new ArrayList();
>       for (int i = 0 ; i<10;i++) {
>         content.add("row " + i);
>       }
>       hdt.setValue(content);
>
>       // create column
>       UIColumn column = (UIColumn)app.createComponent(HtmlSimpleColumn.COMPONENT_TYPE);
>
>       // create and add header
>       UIOutput header = (UIOutput)app.createComponent(HtmlOutputText.COMPONENT_TYPE);
>       header.setValue("Last Column");
>       column.setHeader(header);
>
>       // create and add content
>       UIOutput text = (UIOutput)app.createComponent(HtmlOutputText.COMPONENT_TYPE);
>       ValueBinding valueBinding = app.createValueBinding(#{hdtVar1})
>       text.setValueBinding("value", valueBinding);
>       column.getChildren().add(text);
>
>       // add column
>       hdt.getChildren().add(column);
>
>
>
> Ok ... it is not possible to pass a parameter using "valuebinding" - so, there is no
way
> to call #{hdtVar1.name(mystring)} ... right?
>
> Is there a way to call a bean-setter and set the current object (of the datatable-iteration)
> in my bean, so that I'm able to call something like 'String whatever = hdtVar1.getName("mystring")'
> and do a 'text.setValue(whatever)' from there?
>
> Thanks,
> Harry
>


--
Mathias

Mime
View raw message