List of Links in DataTable
I have a dataTable listing customers. I have a column that I want to contain the customer name followed by a list of tags (strings) as commandLinks. Is it possible to do this? I am using NetBeans 5.5 JSF 1.2.
My data object contains
Customer{
long id;
String customerName;
List<Tag> tags;
}
Tag object is
Tag{
String tagName;
}
My JSP contains a datatable with a column such as:
<h:dataTable value="#{bean.customers}" var="row">
<h:column>
<f:facet name="header"><h:outputText value="Customer"></h:outputText></f:facet>
<h:outputText value="#{row.customerName}"/>
<c:foreach items="#{row.tags}" var="tag">
<h:outputText value="#{tag.tagName}" />
</c:foreach>
</h:column>
</h:dataTable>
After experimenting I'm guessing that still doesn't work. So I tried making the JSP:
...
<h:column>
.. header facet ..
<h:panelGroup binding="#{bean.myPG}"/>
</h:column>
...
Then in my bean I have a function
HtmlPanelGroup getMyPG(){
}
In that method I try to grab dataTable.getRowData(), which is a customer. Then pull the list of tags off the customer object, build a list of commandLinks in a panelGroup and return that panelGroup.
I think after debugging that binding= are getting processed once not on a per-row basis. How can I build this list of commandLinks dynamically per row of data?
Will this work? I'm not having much luck with it. Any suggestions?
Nick

