2017-09-23 43 views
0

我想在用戶確認確認對話框中的動作後更新數據表,但它不起作用。Primefaces確認對話框不更新數據表

<p:panel id="formPanel" header="Welcome #{sessionBean.name}"> 
    <h:form id="dtForm"> 
     <p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" globalOnly="true" /> 
     <p:dataTable id="classList" var="class" value="#{listClassBean.classList}" widgetVar="classListDT" 
        paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
        paginator="true" rows="10" rowsPerPageTemplate="5,10,15" paginatorPosition="bottom" 
        rowKey="#{class.classroomId}" style="margin: 20px 20px 20px 20px;"> 

      <!--columns omitted--> 

      <p:column headerText="Exit" rendered="#{sessionBean.loggedAccount.accType == 'S'}" 
         style="width: 50px; text-align: center;"> 
       <p:commandButton icon="fa fa-sign-out" action="#{listClassBean.exitClass(class.classroomId)}" 
           styleClass="redbutton" process="dtForm:classList" update="dtForm:classList"> 
        <p:confirm header="Exit Class" 
           message="Are you sure you want to exit the class #{classroomSettingBean.classroom.classroomId}?" 
           icon="ui-icon-alert"/> 
       </p:commandButton> 
      </p:column> 
     </p:dataTable> 
    </h:form> 
</p:panel> 

<h:form> 
    <p:confirmDialog global="true" showEffect="clip" hideEffect="clip"> 
     <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> 
</h:form> 

一切運行良好,只是它不更新數據表。任何想法?

+0

運行您在JSF開發模式的應用程序。然後檢查是否有任何錯誤。也可以嘗試添加一個'p:messages'並讓它自動更新並查看它告訴你的內容。 – Kukeltje

+0

如何在jsf開發模式下運行?並沒有消息顯示... – Newbie

+0

它在(好)jsf教程中,谷歌abd更多。從閱讀開始http://www.stackoverflow.com/tags/jsf/info – Kukeltje

回答

0

您剛剛形式和這樣的面板之間的逆:

<h:form id="dtForm"> 
     <p:panel id="formPanel" header="Welcome #{sessionBean.name}"> 

.... 

     </p:panel> 
</h:form> 
0

我有一個相關的問題,這一點,我如何解決它,只是我使用號碼:對話框來代替。 textarea更新dataTable'codeTable'中的記錄「MyMessage」。

<p:dialog header="Customize Message" id="editDlg" widgetVar="displayDlg" modal="true" resizable="false" width="450"> 
 
    <p:inputTextarea id="resin" value="#{MyBean.myMessage}" style="width: 400px; height: 150px; padding: 10px; resize: none" maximum="550" /> 
 
    <p:commandButton value="Cancel" onclick="PF('displayDlg').hide()" style="width: 75px; left: 220px" /><br/> 
 
    <p:commandButton value="Update" action="#{myBean.updateMyMessage()}" update="form:my_growl" onclick="PF('displayDlg').hide()" style="width: 75px; left: 220px" oncomplete="refreshTable();" /> 
 
</p:dialog> 
 
<p:remoteCommand name="refreshTable" action="#{paybill.userPayBillDetails()}" partialSubmit="true" process="@this, editDlg" update="codeTable" />