我使用过Primefaces。我在对话框中有一个dataTable,当我尝试对它进行排序/过滤时,对话框会关闭。我假设无论何时进行ajax调用,它都会关闭对话框。我也试着做一个"测试"示例按钮,它也会关闭对话框。 有没有办法阻止这种情况?
<p:outputPanel autoUpdate="true" deferredMode="true" deferred="visible">
<p:dialog height="700px" width="100%" closable="true" closeOnEscape="true" header="Sample table" widgetVar="sampleDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false">
<h:form>
<p:dataTable id="fooTableCurrent"
var="business"
value="#{mainViewController.lazyModel}"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
paginator="true" rows="20" style="width: 100%; text-align: center;"
rowsPerPageTemplate="10,20,50,100,200"
emptyMessage="No records found with given criteria"
editable="true"
lazy="true"
scrollable="true"
scrollHeight="100px">
<p:ajax event="rowEdit" listener="#{mainViewController.onBusinessRowEdit}" />
<p:ajax event="rowEditCancel" listener="#{mainViewController.onBusinessRowCancel}" />
<p:column headerText="Employee reg. #">
<h:outputText value="#{business.employee.employee_ID}" />
</p:column>
<p:column headerText="Employee">
<h:outputText value="#{business.employee.name}" />
</p:column>
<p:column headerText="Bank">
<h:outputText value="#{business.bank.name}" />
</p:column>
<p:column headerText="Office" filterStyle="width:60px;" filterBy="#{business.office.office_ID}" filterMatchMode="contains">
<h:outputText value="#{business.office.name}" />
</p:column>
<p:column headerText="Product group" style="width: 100px;">
<h:outputText value="#{business.product.product_group.name}" />
</p:column>
<p:column headerText="Product" filterStyle="width:60px;" filterBy="#{business.product.product_ID}">
<h:outputText value="#{business.product.name}" />
</p:column>
<p:column headerText="Contract" filterStyle="width:60px;" filterBy="#{business.contract}">
<h:outputText value="#{business.contract}" />
</p:column>
<p:column headerText="Value" sortBy="#{business.value}">
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{business.value}" /></f:facet>
<f:facet name="input"><h:inputText value="#{business.value}" /></f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Date" sortBy="#{business.insert_date}">
<h:outputText value="#{business.insert_date}" />
</p:column>
<p:column headerText="Approved" width="55" style="text-align: center;">
<p:selectBooleanCheckbox disabled="true" value="#{true}" />
</p:column>
<p:column style="width:32px" headerText="Edit">
<p:rowEditor />
</p:column>
<p:column headerText="Delete" width="30">
<p:commandButton icon="ui-icon-close" actionListener="#{mainViewController.deleteBusiness(business)}" update="@form">
<p:confirm header="Confirmation" message="Are you sure?" icon="ui-icon-alert" />
</p:commandButton>
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
<p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>
</p:column>
</p:dataTable>
</h:form>
</p:dialog>
</p:outputPanel>
答案 0 :(得分:1)
问题出在outputPanel标签上。删除autoUpdate="true"
后,一切都成了魅力。
答案 1 :(得分:0)
您可以使用属性a:b
强制对话框再次显示。