经过这么多搜索后,在点击主要对话框中点击命令按钮后,我无法找到更新数据表的方法。
我的mainMenu.xhtml有一个数据表,如:
<section id="ownermanagement">
<h:form id="ownermanagementform">
<p:commandButton class="btn icon-cart" actionListener="#{ownerControl.viewNewOwnerDialog()}" value="کارفرما جدید"/>
<br></br><br></br>
<p:growl id="growl" showDetail="true"/>
<p:dataTable filterEvent="enter" id="ownerdatatable" value="#{ownerControl.ownerList}" var="owners" dir="rtl" emptyMessage="موردی با این مشخصات یافت نشد." style="border: 1px solid black;">
<p:column filterBy="#{owners.id}" filterMatchMode="contains">
<f:facet name="header">شناسه</f:facet>
#{owners.id}
</p:column>
<p:column filterBy="#{owners.name}" filterMatchMode="contains">
<f:facet name="header">نام</f:facet>
#{owners.name}
</p:column>
<p:column>
<f:facet name="header">عملیات</f:facet>
<p:commandButton value="ویرایش کارفرما"
actionListener="#{ownerControl.viewEditOwnerDialog(owners)}" update="ownerdatatable"/> |
<p:commandButton value="حذف کارفرما"
action="#{ownerControl.removeOwner(owners)}"
onclick="return confirm('آیا از حذف کارفرما اطمینان دارید؟')"
update="ownerdatatable"/>
</p:column>
</p:dataTable>
</h:form>
</section>
我打开我的对话框:
<p:commandButton class="btn icon-cart" actionListener="#{ownerControl.viewNewOwnerDialog()}" value="کارفرما جدید"/>
viewNewOwnerDialog方法是:
public void viewNewOwnerDialog() {
Map<String, Object> options = new HashMap<String, Object>();
//options.put("modal", true);
options.put("resizable", false);
resetInputs();
RequestContext.getCurrentInstance().openDialog("createOwner", options, null);
}
这将在对话框中打开我的createOwner页面:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>کارفرما جدید</title>
<link rel="stylesheet" type="text/css" href="resources/style/elements.css" />
</h:head>
<h:body dir="rtl">
<h:form id="newOwnerForm">
<p:growl id="growl" showDetail="true" sticky="true"/>
نام: <h:inputText class="InputField" value="#{ownerControl.owner.name}"/>
<br></br><br></br>
توضیحات: <p:inputTextarea class="textArea" value="#{ownerControl.owner.description}" rows="5" cols="100" counter="display" maxlength="500" counterTemplate="{0}" autoResize="false" />
<h:outputText id="display" /><br></br>
<p:commandButton class="btn icon-cart" value="ثبت" action="#{ownerControl.insertOwner()}" process="@all" update=":ownermanagementform:ownerdatatable"/>
</h:form>
</h:body>
</html>
如何更新咆哮以显示消息,然后更新mainMenu的数据表?
目前,我收到此错误:
Cannot find component with expression ":ownermanagementform:ownerdatatable" referenced from "newOwnerForm:j_idt10".
谢谢!
答案 0 :(得分:0)
<p:commandButton value="Open Dialog" actionListener"...">
<p:ajax event="dialogReturn" update="datatableID"/>
</p:commandButton>