Bonjour,
Sous PrimeFaces j'ai crée une dataTable et lorsque je souhaite supprimer un élément de la dataTable elle est supprimé mais ensuite lors d'une deuxième suppression la dataTable n'est pas rafraichit.
Code java : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 public String deleteEntityForm(ActionEvent actionEvent) { if (this.getEntityId() == null && (this.getParameter("eid") != null)) { setEntityId(new Long(getParameter("eid"))); } if (this.getEntityId() != 0 && (this.getParameter("eid") != null)) { try { entityForm = ManagerUtils.getEntityForm(this.getEntity()); entityForm.setId(this.getEntityId()); entityForm.delete(); pivotTable.setDatas(manager.getAll()); // penser à recharger la liste des données return "/list.xhtml?e=" + this.getEntity(); } catch (Exception ex) { ex.getMessage(); } } return ""; }Merci d'avance.
Code jsf : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 <!-- dataTable --> <p:dataTable id="listTable" var="data" value="#{listForm.lazyEntities}" rowKey="#{data.id}" paginator="true" rows="25" rowsPerPageTemplate="10,25,50" lazy="true"> <p:columns var="column" value="#{listForm.pivotTable.columns}" filterMatchMode="contains" columnIndexVar="colIndex" sortBy="#{data[column.property]}" filterBy="#{data[column.property]}" > <f:facet name="header"> #{text[column.header]} </f:facet> #{listForm.getColumn(column.property)} </p:columns> <p:column styleClass="small" exportable="false"> <f:facet name="header"> <h:outputText value="#{text['table.action']}" /> </f:facet> <!-- édition de l'entité --> <h:panelGroup styleClass="buttonBar bottom"> <h:commandLink id="edit" styleClass="button view" action="#{listForm.editEntityForm}"> <h:graphicImage name="#{text['action.tab.edit']}" /> <f:param name="e" value="#{listForm.entity}"/> <f:param name="eid" value="#{data.id}"/> <f:param name="from" value="list"/> </h:commandLink> <!-- suppression de l'entité --> <p:commandLink id="delete" styleClass="button delete" actionListener="#{listForm.deleteEntityForm}" update=":formDynamicTable:listTable" ajax="true" process="@this" onstart="bCancel=true; return confirmDelete('#{text[listForm.pivotTable.title]}')"> <h:graphicImage name="#{text['action.tab.delete']}" /> <f:param name="e" value="#{listForm.entity}"/> <f:param name="eid" value="#{data.id}"/> <f:param name="from" value="list"/> </p:commandLink> </h:panelGroup> </p:column> </p:dataTable>
Transact.
Partager