webtier@glassfish.java.net

Dynamic datatable+expression

From: <webtier_at_javadesktop.org>
Date: Tue, 07 Jul 2009 02:24:42 PDT

Hi!

I'm building a dynamic datatable with jsf 2.0 (Mojarra beta1). By dynamic, i mean not only the rows are generated, but the columns also.

<h:dataTable binding="#{myBean.dataTable}" value="#{myBean.dataList}" var="var">
</h:dataTable>

I want to set the rendered property of an added component, not statically, but based on an expression.

HtmlCommandLink appendCategoryLink = new HtmlCommandLink();
appendCategoryLink.setValueExpression("rendered", Utils.createValueExpression("#{var.leaf}", Boolean.class));
appendCategoryLink.setValue("Add");

The 'leaf' is always there, and there are cases where its value is 'true'.
However, it is always evaluated to false. If i write #{true} instead of #{var.leaf}, the link is displayed correctly.
[Message sent by forum member 'gabox01' (gabox01)]

http://forums.java.net/jive/thread.jspa?messageID=354313