2011-07-17 4 views
0

primefaces에서 구성 요소를 업데이트하는 데 문제가 있습니다.프라임 테이블에서 데이터 테이블을 업데이트하는 중 문제가 발생했습니다.

  <h:form> 
      <p:panel style="width: 350px;" header="Partial Process"> 
      <p:dataTable id="tablaPersonas" var="per" value="#{manejador.lista}"> 
       <p:column style="text-align: center;"> 
        <f:facet name="header"> 
         <h:outputText value="Nombre" /> 
        </f:facet> 
        <h:outputText value="#{per.nombre}" /> 
       </p:column> 
       <p:column style="text-align: center;"> 
        <f:facet name="header"> 
         <h:outputText value="Apellido" /> 
        </f:facet> 
        <h:outputText value="#{per.apellido}" /> 
       </p:column> 
       <p:column headerText="Editar" style="text-align: center;"> 
        <p:commandButton value="Editar"/> 
       </p:column> 
      </p:dataTable> 
    </p:panel> 
      <p:commandButton value="Abrir" onclick="widgetDlgAgregar.show();"/> 

      <p:dialog header="Agregar" widgetVar="widgetDlgAgregar" width="250" height="150" closable="true"> 
       <h:panelGrid id="gridAdd" columns="2"> 
        <h:outputLabel value="Nombre:"/> 
        <p:inputText value="#{manejador.auxiliarAgregar.nombre}"/> 

        <h:outputLabel value="Apellido:"/> 
        <p:inputText value="#{manejador.auxiliarAgregar.apellido}"/> 

        <p:commandButton oncomplete="widgetDlgAgregar.hide();" update="tablaPersonas,gridAdd" value="Agregar" actionListener="#{manejador.agregarPersona}"/> 
       </h:panelGrid> 
      </p:dialog> 

     </h:form> 

보시다시피, 나는 "Abrir"과 대화라는 명령 단추를 클릭 제목으로 "Agregar"가 열립니다 : 다음은 한 예입니다. 입력란을 채우고 CommandButton "Agregar"를 클릭하면 DataTable이 업데이트되지 않습니다. 왜 이런 일이 일어나는 걸까요?

답변

1

아 미안 난 당신이

시도이 업데이트를 잊었다 생각 이게 잘해야 해.

  <h:form prependId="false"> 
      <p:panel style="width: 350px;" header="Partial Process"> 
       <p:dataTable id="tablaPersonas" var="per" 
        value="#{manejador.lista}"> 
        <p:column style="text-align: center;"> 
         <f:facet name="header"> 
          <h:outputText value="Nombre" /> 
         </f:facet> 
         <h:outputText value="#{per.nombre}" /> 
        </p:column> 
        <p:column style="text-align: center;"> 
         <f:facet name="header"> 
          <h:outputText value="Apellido" /> 
         </f:facet> 
         <h:outputText value="#{per.apellido}" /> 
        </p:column> 
        <p:column headerText="Editar" style="text-align: center;"> 
         <p:commandButton value="Editar" /> 
        </p:column> 
       </p:dataTable> 
      </p:panel> 
      <p:commandButton value="Abrir" onclick="widgetDlgAgregar.show();" update="gridAdd" /> 



      <p:dialog header="Agregar" widgetVar="widgetDlgAgregar" width="250" 
       height="150" closable="true"> 
       <h:panelGrid id="gridAdd" columns="2"> 
        <h:outputLabel value="Nombre:" /> 
        <p:inputText value="#{manejador.auxiliarAgregar.nombre}" /> 

        <h:outputLabel value="Apellido:" /> 
        <p:inputText value="#{manejador.auxiliarAgregar.apellido}" /> 

        <p:commandButton oncomplete="widgetDlgAgregar.hide();" 
         update="tablaPersonas,gridAdd" value="Agregar" 
         actionListener="#{manejador.agregarPersona}" /> 
       </h:panelGrid> 
      </p:dialog> 

     </h:form> 
0

시도는 형태로 외부에서

<p:dialog header="Agregar" widgetVar="widgetDlgAgregar" width="250" height="150" closable="true">

을 넣어 추가 prependId = "false"를 양식에 <h:form prependId="false" >

관련 문제