2012-07-04 50 views
0

我有一個對話框和兩個命令按鈕。點擊該選項後,對話框不會消失。以下是代碼片段。我正在使用confirmation.hide()選項。確認後確認對話框沒有消失

<p:confirmDialog 
    message="Are you sure about deleting the substudyplan?" 
    id="confirmation" 
    header="Confirmation Deleting substudyplan" severity="alert" 
    appendToBody="TRUE" widgetVar="cd"> 
     <p:commandButton value="Yes Sure" 
       actionListener="#{editBean.deleteSubStudyPlan(selectedRow)}" 
       update=":studyPlanEditForm" 
      oncomplete="confirmation.hide()" /> 
     <p:commandButton value="Not Yet" onclick="confirmation.hide();" 
     type="button" /> 
</p:confirmDialog> 
+0

當你點擊它時,你的'Not Yet'按鈕是否工作?它只是'沒錯'按鈕,不工作? – BestPractices

回答

0

widgetVarCD

所以你應該與它的名稱來訪問它,當你試圖所以用它

,改變confirmation.hide()cd.hide()

或者,從命名widgetVarcd確認

此外,通過查看該ConfirmDialog inside form does not closes with update @form,您可能希望縮小oncompleteupdate=":studyPlanEditForm"update=":someOtherWrapperInsideForm"

+0

嗨,我改變了它,但它沒有奏效。 actionListener正在被調用,但對話框沒有關閉。 –

+0

更新你的代碼,然後... – Daniel

+0

怪異的,嘗試用appendToBody =「true」替換appendToBody =「TRUE」',還有你有嵌套窗體的機會嗎? (窗體內部形式) – Daniel

0

嘗試onclick代替。 根據我的經驗onsuccess,onerroroncomplete並不總是按預期工作。

+0

嗨我用一個簡單的對話框而不是確認對話框解決了問題。 –

+0

很高興她! 我是stackoverflow的新手,還沒有人問這個問題。也許你應該把它標記爲解決方法。 – weaselflink