如何解决数据表列中的Primefaces删除和确认对话框-删除一行-不起作用
我正在使用Primefaces数据表,并且有一列包含删除按钮。我正面临类似的问题,例如:Primefaces Delete & Confirm Dialog inside table column - Update or Freeze
我尝试了那里给出的解决方案,但是没有用。在我的情况下,未调用在vehiTypeListMngr.deletVehicleType
的{{1}}中注册的方法actionListener
。此外,<p:commandButton
在确认对话框中显示为空。知道为什么它不起作用吗?
#{vehiTypeListMngr.selectedVehiType.type}
托管豆:
<h:body> <h:form id="formListVehiType"> <p:dataTable id="vTypeTable" var="vType" value="#{vehiTypeListMngr.vehiTypes}" rowKey="#{vType.vehicleTypeId}" style="margin-bottom:20px" paginator="true" rows="10" paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}" currentPageReportTemplate="{startRecord}-{endRecord} of {totalRecords} records" rowsPerPageTemplate="5,10,15" selection="#{vehiTypeListMngr.selectedVehiType}" selectionMode="single"> <p:column headerText="VehicleTypeId" visible="none"> <h:outputText value="#{vType.vehicleTypeId}" /> </p:column> <p:column headerText="Vehicle Type" style="width:120px;"> <h:outputText value="#{vType.type}" /> </p:column> <p:column headerText="Delete" style="width:45px; text-align: center;"> <p:commandButton value="" icon="ui-icon-delete" type="button" styleClass="ui-confirmdialog-yes" oncomplete="PF('deleteDlg').show();" update=":formListVehiType:display"> <f:setPropertyActionListener value="#{vType}" target="#{vehiTypeListMngr.selectedVehiType}" /> </p:commandButton> </p:column> </p:dataTable> <p:dialog id="confirmDeleteDialog" widgetVar="deleteDlg" showEffect="fade" hideEffect="explode" header="Confirm" severity="alert" modal="true"> <h:panelGrid id="display" columns="2" cellpadding="4" style="margin:0 auto;"> <h:outputText value="Are you sure you want to delete?" /> <h:outputText value=" "/> <h:outputText value="#{vehiTypeListMngr.selectedVehiType.type}" style="font-weight:bold" /> <h:outputText value=" "/> <p:commandButton id="confirm" value="Yes" type="button" actionListener= "#{vehiTypeListMngr.deletVehicleType((vehiTypeListMngr.selectedVehiType))}" styleClass="ui-confirmdialog-yes" icon="pi pi-check" update=":formListVehiType:vTypeTable" oncomplete="deleteDlg.hide()"/> <p:commandButton value="No " type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times" onclick="deleteDlg.hide()" /> </h:panelGrid> </p:dialog> </h:form> </h:body>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。