My problem consists in deleting an item from data table. When i click on the button delete a confirm Dialog will appear to confirm removing the row from database. If so, the data will be removed but the data table isn't updated unless i logout and login and if i select another item it won't be even deleted.
<h:form id="form">
<p:panel id="panelform" header="Databases" >
<p:dataTable value="#{dataMB.customersDatas}" var="item" id="datas" rowsPerPageTemplate="5,10,15,20,25,30" paginator="true" rows="10" filteredValue="#{dataMB.filteredDatas}" selectionMode="single" rowKey="#{item.id}"selection="#{dataMB.selectedData}">
<p:ajax event="rowSelect" update=":form:dataView, :form:deleteButton, :form:viewButton" listener="#{dataMB.onRowSelect}"/>
</p:dataTable>
<p:panel>
<p:commandButton style="width: 8%;height: 100%" id="viewButton" value="View" oncomplete="dataDialogView.show()" disabled="#{dataMB.disabled}" icon="ui-icon-search" title="data details"/>
<p:commandButton style="width: 8%;height: 100%" id="deleteButton" value="Delete" oncomplete="deleteDialog.show()" disabled="#{dataMB.disabled}" icon="ui-icon-trash"/>
</p:panel>
</p:panel>
</h:form>
<p:confirmDialog style="position: absolute; width: 50px; border-color: blue" id="deleteData" message="Your Database Will be completely removed . Are you sure? " appendToBody="true" header="Delete Data" severity="alert" widgetVar="deleteDialog">
<h:form>
<p:commandButton id="confirm" style="width: 25%;height: 100%" value="Confirm" actionListener="#{dataMB.deleteData()}" update=":form:datas" ajax="true" oncomplete="deleteDialog.hide(); purchase.hide();" >
</p:commandButton>
<p:commandButton id="cancel" style="width: 25%;height: 100%" value="Later" onclick="deleteDialog.hide();" type="button" />
</h:form>
</p:confirmDialog>
deleteData() method in my sessionScoped managed Bean
public String deleteData() {
logger.log(Level.SEVERE, "*****delete Data***** ");
dataBusinessLocal.deleteData(selectedData);
return "datalist";
}
"#{dataMB.customersDatas}
getter method wether it returns the updated list of object? If not, the problem seems to be somewhere in persistence/caching. If the list returns the correct dataset, double-check if a refresh of the page in your browser (F5) brings any success. – L-Rayh:datatable
I used to have problems in the past) but thep:panel
around it. – L-Ray