Nested Datatables
hoetschmann Oct 20, 2005 2:47 PMHi,
I have the following requirement, as far as I can't make use of the @DataModel annotation (I think), because I want to render an initially unknown number of DataTables.
Inject a Collection of ListDataModels into the Conversation Context and render them with a nested DataTable:
<ui:define name="content">
<div class="section">
<h:form>
<fieldset>
<div class="section">
<h:dataTable value="#{skills}" var="index">
<h:column>
<h:dataTable value="#{index}" var="skillIndex"
rendered="#{not empty index}">
<f:facet name="header">
<f:verbatim>
<div class="colheader">
<h:outputText value="#{skilleditadmin.nexttyp}"/>
</div>
</f:verbatim>
</f:facet>
<h:column>
<h:outputText value="#{skillIndex.skillname}"/>
</h:column>
<h:column>
<h:commandButton type="submit" value="Delete" action="#{skilleditadmin.remove}"/>
</h:column>
</h:dataTable>
</h:column>
</h:dataTable>
</div>
</fieldset>
</h:form>
</div>
<div class="section">
<h:form>
<fieldset>
<div class="entry">
<div class="label">
<h:outputLabel for="name">Typ:</h:outputLabel></div>
<div class="input">
<h:inputText id="typ" value="#{skilleditadmin.tmptyp}">
<!-- <f:selectItems value="#{typen}"/>-->
</h:inputText>
</div>
</div>
<div class="entry">
<div class="label">
<h:outputLabel for="name">Neuer Skill:</h:outputLabel></div>
<div class="input">
<h:inputText id="name" value="#{skilladmin.skillname}"/>
<h:message for="name" />
</div>
</div>
<div class="entry">
<div class="label"> </div>
<div class="input">
<h:commandButton type="submit" value="Add" action="#{skilleditadmin.add}"/>
<h:commandButton type="submit" value="Cancel" action="#{skilleditadmin.cancel}"/>
</div>
</div>
</fieldset>
</h:form>
</div>
</ui:define>
The corresponding sections in the SessionBean, named skilleditadmin are as follows:
...
@Out
private Collection<ListDataModel> skills;
...
public String remove()
{
log.info("in remove...");
//getRowData and delete the item
}
Unfortunately the method "remove" is never invoked.
When clicking a Remove-Button the page redisplays, without any data(which is displayed, when I renavigate to that page).
(The data is displayed correct, as long as I do not click on the "delete Button".) Adding the data works also fine...
Any ideas, or hints - please?
Thanks
hoetschmann