DataModel PersistentSet problem from rich subtable
amitdk Jul 9, 2007 5:15 PMHello
I have a situation that requires me to use the DataModel and DataModelSelection tags in a rich subtable tag. Here's the xhtml code:
<rich:dataTable value="#{taskObjectives}" var="taskObj"
columnsWidth="70%,15%,15%"
style="align:center">
<f:facet name="header">
<rich:columnGroup>
<rich:column>
<h:outputText value="Assigned Task" />
</rich:column>
<rich:column>
<h:outputText value="Update Unapproved" />
</rich:column>
<rich:column>
<h:outputText value="Remove" />
</rich:column>
</rich:columnGroup>
</f:facet>
<rich:column colspan="3" style="background-color:#F1E1D1">
<h:outputText value="#{taskObj.description}" />
</rich:column>
<rich:subTable var="selectTask" value="#{taskObj.taskAssignments}"
onRowMouseOver="this.style.backgroundColor='#E0E0E0'"
onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
<rich:column>
<h:outputText value="#{selectTask.comments}" />
</rich:column>
<rich:column style="text-align:center">
<s:button type="submit" action="#{report.updateTask}"
value="Update Task" />
</rich:column>
<rich:column style="text-align:center">
<s:button type="submit" action="#{report.removeTask}"
value="Remove Task" />
</rich:column>
</rich:subTable>
</rich:dataTable>
There is a one to many relationship from taskObjective and taskAssignment. DataModel tag is used on the taskObjective, however since taskAssignments aren't exposed that way, I get the following exception on the subtable section:
Caused by: javax.faces.el.PropertyNotFoundException: /WeeklyReport.xhtml @52,55
value="#{selectTask.comments}": Bean: org.hibernate.collection.PersistentSet, pr
operty: comments
at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.ja
va:58)
at javax.faces.component.UIOutput.getValue(UIOutput.java:80)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue
(RendererUtils.java:223)
... 77 more
Is there any built-in way to convert a PersistentSet to a DataModel for use in the the subtable? If not what would be a good way to implement this - use a converter??
Any hints or tips appreciated.
Thanks
Amit Karandikar