2014-11-28 2 views
0

Primefaces 업데이트에 이상한 동작이 있습니다. 여러 개의 출력 텍스트가있는 패널 격자와 여러 행이있는 dataTable이있는 페이지가 있습니다. 행을 수정하면 데이터 테이블이 올바르게 업데이트되지만 새 행을 삽입하거나 행을 삭제하면 업데이트되지 않습니다.Primefaces 이상한 동작 업데이트

<ui:composition> 
    <p:dialog id="composizioneDlg" widgetVar="ComposizioneDialog" modal="true" resizable="false" appendTo="@(body)" header="#{bundle.ListDescImmTitle}"> 
     <h:form id="composizioneListForm"> 
      <p:panelGrid columns="10" rendered="#{immobiliController.selected != null}">      
       <h:outputText value="#{bundle.ViewImmobiliLabel_categoria}"/> 
       <h:outputText value="#{immobiliController.selected.categoria.descrizione}" 
-------SEVERAL OUTPUTS--------------------------------- 
      </p:panelGrid> 

      <p:panel header="#{bundle.ListDescImmTitle}"> 
       <p:dataTable id="datalistComp" value="#{descImmController.composizione}" var="item" > 
-----SEVERAL OPTIONS OF DATA TABLE------------------- 
        <p:ajax event="rowSelect" update="createButton viewButton editButton deleteButton"/> 
        <p:ajax event="rowUnselect" update="createButton viewButton editButton deleteButton"/> 

        <p:column> 
         <f:facet name="header"> 
          <h:outputText value="#{bundle.ListDescImmTitle_stato}"/> 
         </f:facet> 
         <h:outputText value="#{item.stato}"/> 
        </p:column> 
        <p:column> 
         <f:facet name="header"> 
          <h:outputText value="#{bundle.ListDescImmTitle_categoria}"/> 
         </f:facet> 
         <h:outputText value="#{item.categoria}"/> 
        </p:column> 
        <p:column> 
         <f:facet name="header"> 
          <h:outputText value="#{bundle.ListDescImmTitle_descrizione}"/> 
         </f:facet> 
         <h:outputText value="#{item.descrizione}"/> 
        </p:column> 
        <p:column> 
         <f:facet name="header"> 
          <h:outputText value="#{bundle.ListDescImmTitle_mq}"/> 
         </f:facet> 
         <h:outputText value="#{item.mq}"/> 
        </p:column>      
        <f:facet name="footer"> 
         <p:commandButton id="createButton" icon="ui-icon-plus" value="#{bundle.Create}" actionListener="#{descImmController.prepareCreate}" update=":DescImmCreateForm" oncomplete="PF('DescImmCreateDialog').show()"/> 
         <p:commandButton id="editButton" icon="ui-icon-pencil" value="#{bundle.Edit}" update=":DescImmEditForm" oncomplete="PF('DescImmEditDialog').show()" disabled="#{empty descImmController.selected}"/> 
         <p:commandButton id="deleteButton" icon="ui-icon-trash" value="#{bundle.Delete}" actionListener="#{descImmController.destroy}" update=":composizioneListForm:datalistComp, :growl" disabled="#{empty descImmController.selected}"/> 
        </f:facet> 
       </p:dataTable> 
      </p:panel> 
     </h:form> 
    </p:dialog> 
</ui:composition> 

editButton 코드는이 (그리고 그것이 작동) :이 createButton의 코드 (대신 editButton의 업데이트되지 않음)

<ui:composition> 

    <p:dialog id="DescImmEditDlg" widgetVar="DescImmEditDialog" modal="true" resizable="false" appendTo="@(body)" header="#{bundle.EditDescImmTitle}"> 
     <h:form id="DescImmEditForm"> 
      <h:panelGroup id="display"> 
       <p:panelGrid columns="2" rendered="#{descImmController.selected != null}"> 

        <p:outputLabel value="#{bundle.EditDescImmLabel_stato}" for="stato" /> 
        <p:inputText id="stato" value="#{descImmController.selected.stato}" title="#{bundle.EditDescImmTitle_stato}" /> 

        <p:outputLabel value="#{bundle.EditDescImmLabel_descrizione}" for="descrizione" /> 
        <p:inputText id="descrizione" value="#{descImmController.selected.descrizione}" title="#{bundle.EditDescImmTitle_descrizione}" /> 
        <p:outputLabel value="#{bundle.EditDescImmLabel_mq}" for="mq" /> 
        <p:inputText id="mq" value="#{descImmController.selected.mq}" title="#{bundle.EditDescImmTitle_mq}" />      
       </p:panelGrid> 
       <p:commandButton actionListener="#{descImmController.update}" value="#{bundle.Save}" update="display, :composizioneListForm:datalistComp, :growl" oncomplete="handleSubmit(args, 'DescImmEditDialog');"/> 
       <p:commandButton value="#{bundle.Cancel}" onclick="DescImmEditDialog.hide()"/> 
      </h:panelGroup> 
     </h:form> 
    </p:dialog> 

</ui:composition> 

인 페이지 코드는 다음과 같다 :

<ui:composition> 

    <p:dialog id="DescImmCreateDlg" widgetVar="DescImmCreateDialog" modal="true" resizable="false" appendTo="@(body)" header="#{bundle.CreateDescImmTitle}"> 
     <h:form id="DescImmCreateForm"> 
      <h:panelGroup id="display"> 
       <p:panelGrid columns="2" rendered="#{descImmController.selected != null}">       

        <p:outputLabel value="#{bundle.CreateDescImmLabel_descrizione}" for="descrizione" /> 
        <p:inputText id="descrizione" value="#{descImmController.selected.descrizione}" title="#{bundle.CreateDescImmTitle_descrizione}" /> 
        <p:outputLabel value="#{bundle.CreateDescImmLabel_mq}" for="mq" /> 
        <p:inputText id="mq" value="#{descImmController.selected.mq}" title="#{bundle.CreateDescImmTitle_mq}" />       
       </p:panelGrid> 
       <p:commandButton actionListener="#{descImmController.create}" value="#{bundle.Save}" update="display, :composizioneListForm:datalistComp, :growl" oncomplete="handleSubmit(args,'DescImmCreateDialog');"/> 
       <p:commandButton value="#{bundle.Cancel}" onclick="DescImmCreateDialog.hide()"/> 
      </h:panelGroup> 
     </h:form> 
    </p:dialog> 

</ui:composition> 

내 잘못은 어디에서 update = ""deleteButton과 createButton에 있습니까?

답변

0

코드를 처음부터 다시 작성했지만 (코드는 동일하지만) 모두 잘됩니다. 이제 작동합니다.