But his expression is ok as well - #{'xxx'} should work, it should
display xxx...
regards,
Martin
On 8/10/07, Adam Winer <[EMAIL PROTECTED]> wrote:
> On 8/10/07, Luka Surija <[EMAIL PROTECTED]> wrote:
> > Hi,
> > I'm trying to create a tr:table using binging, and almost everything
> > works fine except, getting row values in table.
> >
> > I've created in index.xhtml this:
> >
> > <tr:table binding="bean.table" />
> >
> > and in backing bean crating columns, and outputText inside columns. This
> > is working well, but I can't figure out how to set value to the
> > outputText as an expression using row value. Example:
> >
> > table.setValue(getMyData());
> > table.setVar("row");
> > CoreColumn column = new CoreColumn();
> > column.setParetn(table);
>
> Don't do this! setParent() is called for you. Don't ever call
> it on your own (see the Javadoc).
>
> > column.setTransient(true);
> > CoreOutputText text = new CoreOutputText();
> > text.setParent(column);
> > text.setTransient(true);
> > column.getChildren().add(text);
> > table.getChildren().add(column);
> >
> > and now the tricky part. How to set an value to text?
> >
> > 1. case
> > text.setValue("bla"); --- it works, "bla" is showing in each row of the
> > table.
> > 2. case and 3. case
> > ExpressionFactory ef =
> > FacesContext.getCurrentInstance().getApplication().getExpressionFactory();
> > ELContext elContext = FacesContext.getCurrentInstance().getELContext();
> > ValueExpression value =
> > ef.createValueExpression(elContext,"#{'xxx'}",String.class);
> >
> > text.setValue(value) --- "ValueExpression[#{'xxx'}] is showing as output
> > in table cell
> > text.setValueExpression("value",value) --- table cell is empty
>
> You want text.setValueExpression() - the problem will be that
> your ValueExpression is wrong. It needs to be something like:
>
> ValueExpression value =
> ef.createValueExpression(elContext,"#{row.xxx}",String.class);
>
> -- Adam
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces