从对话框更新表单 [英] Update form from dialog
问题描述
我在表单中有一个dataTable;在dataTable中,我有一个按钮,点击时弹出一个对话框;编辑完成后(或没有)我想关闭对话框并刷新数据表。
我想通过ajax事件来关闭,所以即使点击取消按钮,或通过单击转义或栏中的x关闭对话框 - >他应该在我的closeDialog()方法中登陆并刷新数据表。
唯一的问题是,我不知道如何刷新dataTable。
这是我的dataTable(在标题中是我的按钮,弹出对话框):
< p:dataTable id =nzTablewidgetVar =nzTableWemptyMessage =Keine Todos gefunden
var =currentTableItemvalue =#{nichtZugTableController.dataModel}paginator =truerows =15
rowsPerPageTemplate =5,10,15,20,25,30,1000lazy =false paginatorPosition =bottom
paginatorTemplate ={CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}
currentPageReport
filteredValue =#{nichtZugTableController.filteredTodos}filterDelay =500filterEvent =keyup
editable ={ truesortBy =#{currentTableItem.angelegtAm}sortOrder =descending
rendered =#{loginBean.loggedIn and mitViewController.leiterViewActiv and leiterTreeController.nzTableActive}
selection =#{nichtZugTableController .selectedNZTodos}rowKey =#{currentTableItem.meldungId}
resizableColumns =falsestyle =min-width:1200px!important; >
< f:facet name =header>
< p:commandButton value =Zuordnenid =nzAllTableOrdeZuButtonajax =truepartialSubmit = true
process =@ thislabel =ToDo einem Mitarbeiter zuordnenoncomplete =zuordnenDialogW.show();
disabled =#{not nichtZugTableController.hasSelectedNZTodos}
action =#{nichtZugTableController.doToDoArrayToList()}style =float:left;/>
< pe:tooltip for =nzAllTableOrdeZuButtonvalue =AusgwählteToDos einem Benutzer zuweisen
myPosition =left centeratPosition =right centershowEffect =fadeInhideEffect =fadeOut
showDelay =700/>
< h:outputText value =#{nichtZugTableController.tableHeaderName }
style =color:#cf0008; font-size:22px;/>
< / f:facet>
...
< / p:dataTable>
以下是我的对话框:
< $ c $< body>
< ui:composition>
< h:form id =zuordnenDialogForm>
< p:dialog id =zuordnenDialogwidgetVar =zuordnenDialogWcloseOnEscape =truedynamic =true
header =ZuordnungappendToBody =falsedraggable =truemodal =trueresizable =false>
< ; p:ajax event =closelistener =#{zuordnenDialogController.closeDialog()}/>
...
< / p:dialog>
编辑1:
这是一张图片,可能有帮助
http://i.stack.imgur.com/pGjes.jpg
你尝试
< p:ajax event =closelistener =#{zuordnenDialogController.closeDialog()}update =:nzTable/>
update =:nzTablewith full path,may be::form_main:nzTable
我想评论,但我没有足够的声望。
I have a dataTable within a form; in the dataTable I have a button which pops up a dialog if clicked; after editing(or not) I want to close the dialog and refresh the datatable.
I want to to this through the ajax event "close", so even if the clicks on cancel button, or closes the dialog by clicking escape or the "x" in the bar -> he should land in my closeDialog()-method and refresh the dataTable.
The only issue is that i don't know how to refresh the dataTable.
Here is my dataTable(in the header is my button which pops up the dialog):
<p:dataTable id="nzTable" widgetVar="nzTableW" emptyMessage="Keine Todos gefunden"
var="currentTableItem" value="#{nichtZugTableController.dataModel}" paginator="true" rows="15"
rowsPerPageTemplate="5,10,15,20, 25, 30, 1000" lazy="false" paginatorPosition="bottom"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="( Treffer {totalRecords} ) ( Seite {currentPage} von {totalPages} )"
filteredValue="#{nichtZugTableController.filteredTodos}" filterDelay="500" filterEvent="keyup"
editable="true" sortBy="#{currentTableItem.angelegtAm}" sortOrder="descending"
rendered="#{loginBean.loggedIn and mitViewController.leiterViewActiv and leiterTreeController.nzTableActive}"
selection="#{nichtZugTableController.selectedNZTodos}" rowKey="#{currentTableItem.meldungId}"
resizableColumns="false" style="min-width:1200px !important; ">
<f:facet name="header">
<p:commandButton value="Zuordnen" id="nzAllTableOrdeZuButton" ajax="true" partialSubmit="true"
process="@this" label="ToDo einem Mitarbeiter zuordnen" oncomplete="zuordnenDialogW.show();"
disabled="#{not nichtZugTableController.hasSelectedNZTodos}"
action="#{nichtZugTableController.doToDoArrayToList()}" style="float: left;" />
<pe:tooltip for="nzAllTableOrdeZuButton" value="Ausgwählte ToDos einem Benutzer zuweisen"
myPosition="left center" atPosition="right center" showEffect="fadeIn" hideEffect="fadeOut"
showDelay="700" />
<h:outputText value="#{nichtZugTableController.tableHeaderName}"
style="color:#cf0008; font-size: 22px;" />
</f:facet>
...
</p:dataTable>
Here is my dialog:
<body>
<ui:composition>
<h:form id="zuordnenDialogForm">
<p:dialog id="zuordnenDialog" widgetVar="zuordnenDialogW" closeOnEscape="true" dynamic="true"
header="Zuordnung" appendToBody="false" draggable="true" modal="true" resizable="false">
<p:ajax event="close" listener="#{zuordnenDialogController.closeDialog()}" />
...
</p:dialog>
EDIT 1:
Here is a picture, maybe it helps
http://i.stack.imgur.com/pGjes.jpg
Did you try
<p:ajax event="close" listener="#{zuordnenDialogController.closeDialog()}" update=":nzTable"/>
update=":nzTable" with full path, may be: :form_main:nzTable
i want to comment, but i don't have enought reputation.
这篇关于从对话框更新表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!