Hi Mathias!
Thanks for your answer.
Unfortunately I've still some problems with it ...
Changes I've made:
List contentList = new ArrayList();
for (int i = 0 ; i<10;i++) {
contentList.add("row " + i);
}
DataModel content = new ListDataModel(contentList);
hdt.setValue(content);
The console-output looks like:
[STDOUT] >>>>>>>>>> ==> ROWCOUNT 2
[STDOUT] >>>>>>>>>> ==> ROWINDEX 0
[STDOUT] >>>>>>>>>> ==> WRAPPEDDATA [EMAIL PROTECTED], [EMAIL PROTECTED]
[STDOUT] >>>>>>>>>> ==> ROWDATA [EMAIL PROTECTED]
[STDOUT] >>>>>>>>>> ==> ROWCOUNT 2
[STDOUT] >>>>>>>>>> ==> ROWINDEX 0
[STDOUT] >>>>>>>>>> ==> WRAPPEDDATA [EMAIL PROTECTED], [EMAIL PROTECTED]
[STDOUT] >>>>>>>>>> ==> ROWDATA [EMAIL PROTECTED]
As you can see there are 2 elements (wrappeddata) but the rowindex is not
incremented during the iteration ... so I always get the first element/object
back by using 'content.getRowData()'.
What am I doing wrong?
Thanks,
Harry
-----Ursprüngliche Nachricht-----
Von: Mathias Brökelmann [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 12. Dezember 2005 15:39
An: MyFaces Discussion
Betreff: Re: datatable - parameter passing - workaround?
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 <[EMAIL PROTECTED]>:
> 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