2017-04-04 220 views
0

我有一個問題,因爲我想保持一個Primefaces對話框打開,但每次按下注冊按鈕時,它都會關閉。需要保持打開Primefaces對話框

這樣,當數據加載良好時,不會是一個大問題。由於它們被記錄在數據庫中並且操作結束。

我的目的是讓對話框保持在屏幕上,直到我決定用另一個按鈕關閉它。這是因爲如果驗證引發錯誤,則應該保留,直到它們更正數據或決定不註冊。

附對話框代碼:

  <h:form id="frmAltaCombustible"> 
       <p:dialog header="Nuevo Combustible" widgetVar="dialogoNuevoCombustible" resizable="false" width="900" showEffect="explode" hideEffect="explode" > 
        <p:panelGrid id="nuevoCombustible" columns="3"> 
         <p:outputLabel value="Identificador de Combustible:" for="txtIdentificador"/> 
         <p:inputText id="txtIdentificador" label="Identificador" value="#{mbCombustibles.combustible.idcombustible}"> 
          <f:validator validatorId="validadorVacio"/> 
         </p:inputText> 
         <p:message for="txtIdentificador"/> 
         <p:outputLabel value="Nombre de combustible:" for="txtDescripcion"/> 
         <p:inputText id="txtDescripcion" label="Nombre" value="#{mbCombustibles.combustible.descripcion}"> 
          <f:validator validatorId="validadorVacio"/> 
         </p:inputText> 
         <p:message for="txtDescripcion"/> 
         <p:commandButton value="Registrar Combustible" actionListener="#{mbCombustibles.registrar()}" update=":frmAltaCombustible,:frmListaCombustibles"/> 
        </p:panelGrid> 
       </p:dialog> 
      </h:form> 
+0

然後只是不更新​​包含表格的完整表格 – Kukeltje

回答

2

如果你想要做的就是更新你應該使用update="nuevoCombustible",而不是在對話框中的表單字段。

假設您的對話框是通過使用JavaScript更改CSS屬性來呈現的,那麼當組件重新呈現時,您將實際上失去這些值。

+0

這是完美的。 但我忘了告訴你,Dialog從一個數據表中的按鈕實例化它,並且不以這種方式更新它。 對不起,遺忘。 –