Первые некоторые объяснения:Primefaces DataTable с атрибутом выбора - динамические таблицы
Я создаю динамически в accordeonpanel и в каждой вкладке я создать р: DataTable (динамически).
Теперь мне нужно отредактировать строки таблиц, но мой метод в «выборе» не вызывается. Я думаю, что из-за вышеупомянутого объясненного динамизма.
метод: evaluationController.deleteIndicator()
Кто-нибудь есть идеи, как это исправить?
Вот код:
XHTML:
<!-- **************************************** ACCORDEON **************************************** -->
<p:panel id="mainAccordeonHeader" header="Capacités et dégrés de maîtrise" styleClass="panelSearch">
<h:form id="evalAccordionForm" styleClass="orgForm">
<p:accordionPanel id="evalAccordion"
styleClass="orgAccordion"
value="#{evaluationController.availableCapacitys}"
var="capListItem">
<p:tab id="evalAccordTitle">
<f:facet name="title">
<h:panelGrid columns="4">
<h:outputText value="#{capListItem.name}"/>
<h:outputText value="#{capListItem.isThresholdOfSuccess ? 'Capacité Déterminante' : 'Degré de Maitrise'}" />
<h:outputText value="Nr Indicateurs: #{evaluationController.findNumberOfIndicators(capListItem)}"/>
<h:outputText value="Pondération: #{evaluationController.findCapacityPonderation(capListItem)}"/>
</h:panelGrid>
</f:facet>
<!-- CAPACITY DETAIL-->
<table border="0" >
<thead>
<tr>
<th>
<p>Description</p>
</th>
<th>
<p style="float: right">Pondération</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p:inputTextarea id="capDescTextArea" rows="3" cols="113" value="#{capListItem.description}" readonly="true"/>
</td>
<td>
<p:inputTextarea style="float: right" id="capPonderationTextArea" rows="1" cols="1" readonly="true" value="#{evaluationController.findCapacityPonderation(capListItem)}"/>
</td>
</tr>
</tbody>
</table>
<p:separator />
<!-- INDICATORS-->
<h:form>
<p:contextMenu for="indicatorTable">
<p:menuitem value="Modifier" update="indicatorTable" icon="ui-icon-wrench" actionListener="#{evaluationcontroller.updateIndicator()}"/>
<p:menuitem value="Supprimer" update="indicatorTable" icon="ui-icon-trash" actionListener="#{evaluationController.deleteIndicator()}"/>
<p:menuitem value="Ajouter" update="indicatorTable" icon="ui-icon-plus" actionListener="#{evaluationController.addIndicator()}"/>
<p:separator/>
<p:menuitem value="Annuler action"/>
</p:contextMenu>
<p:dataTable
id="indicatorTable"
value="#{evaluationController.findIndicatorsByCapacity(capListItem)}"
var="indicator"
editable="true"
tableStyle="indicatorTableStyle"
rowKey="#{indicator.id}"
selection="#{evaluationcontroller.selectedIndicatorRow}" selectionMode="single"
>
<f:facet name="header">Les Indicateurs (#{evaluationController.findNumberOfIndicators(capListItem)})
</f:facet>
<p:column headerText="Org Ut" >
<h:outputText value ="#{indicator.organizedUt.id}"/>
</p:column>
<p:column headerText="Date">
<h:outputText value ="#{indicator.organizedUt.toString()}"/>
</p:column>
<p:column headerText="Nom">
<h:outputText value ="#{indicator.name}"/>
</p:column>
<p:column headerText="Description" toggleable="false" width="450">
<p:outputLabel value ="#{indicator.description}" />
</p:column>
<p:column headerText="Max" toggleable="false" width="30">
<p:inputTextarea style="float: none" rows="1" cols="1" readonly="true" value="#{indicator.maxPossible}"/>
</p:column>
</p:dataTable>
<p:commandButton styleClass="addButtonStyle" icon="ui-icon-plus" value="Ajouter un indicateur"/>
<p:commandButton styleClass="deleteAllButtonStyle" icon="ui-icon-trash" value="Supprimer tous les indicateurs" actionListener="#{evaluationController.deleteIndicator()}"/>
</h:form>
</p:tab>
</p:accordionPanel>
</h:form>
</p:panel>
Controler:
Вот проблема: Getter сеттер не вызывается, когда я выбрать строку!
public Indicator getSelectedIndicatorRow() {
System.out.println("GETTER - selectedIndicatorRow");
return selectedIndicatorRow;
}
public void setSelectedIndicatorRow(Indicator selectedIndicatorRow) {
this.selectedIndicatorRow = selectedIndicatorRow;
System.out.println("SETTER - selectedIndicatorRow");
}
public void deleteIndicator(){
System.out.println("Function: deleteIndicator");
try {
System.out.println("TRY TO DELETE INDICATOR");
indicatorFacade.remove(selectedIndicatorRow);
List<Indicator> tempIndicatorsList = actualGridHM.get(selectedIndicatorRow.getCapacity());
actualGridHM.remove(selectedIndicatorRow.getCapacity());
tempIndicatorsList.remove(selectedIndicatorRow);
actualGridHM.put(selectedIndicatorRow.getCapacity(), tempIndicatorsList);
System.out.println("INDICATOR DELETED!");
}
catch (Exception e) {
System.out.println("ERROR - DELETE OF INDICATOR NOT WORKED!");
}
У кого-нибудь есть решение? Может быть, другой способ редактировать эту динамическую таблицу (помещен в динамический аккорд)?