2014-11-28 4 views
0

У меня странное поведение при обновлении Primefaces: У меня есть страница с сеткой панели с несколькими выходными текстами и dataTable с несколькими строками. Если я правильно изменяю строку, это должно быть правильно, но если я вставляю новую строку или удаляю строку, она не обновляется. Код страницы следующее:Поверхности обновляют странное поведение

<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 это (и это работает):

<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> 

Это код CreateButton (не обновлять вместо editButton):

<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

После перезаписи кода с самого начала (но с тем же кодом) все идет хорошо. Сейчас он работает

Смежные вопросы