Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am working with a DataTable that can be expanded to show the variations of a product. This variation should be editable and I thought about the inplace componenet to do so. However, when trying to save, the new is not sent to the back-end.

Here is part of the xhtml
HTML
<h:form&gt;
   <p:dataTable id="grid-anuncios"
      value="#{gerenciadorAnuncioController.model}" 
      selection="#{gerenciadorAnuncioController.anunciosMLSelecionados}"
      rowKey="#{anuncio.id}"
      rowHover="false"
      editable="true"
      editMode="row"
      var="anuncio" 
      emptyMessage="Nenhum anúncio encontrado"
      rows="50"
      resizableColumns="true"
      styleClass="Top GrayBorder BoxShadow"
      paginator="true"
      lazy="true">

      <!--columns and stuff-->
      <p:rowExpansion>
         <div class="flexPanels">
            <ui:repeat value="#{anuncio.variations}"
               var="variacao">
               <p:outputPanel styleClass="panelVariacoes BoxShadowLight">
                  <div class="panelVariacoesHeader">
                     <p:graphicImage value="#{variacao.urlPrimeiraImagem}" styleClass="logoImage" />
                  </div>
                  <div class="panelVariacoesBody">
                     <p:outputPanel class="MarBot5 Fs15">
                        <h:outputText styleClass="FontLatoBold" value="Qtd: " />
                        <!-- The problem seems to be here -->
                        <p:inplace editor="true">
                           <p:ajax event="save" 
                                 process="@parent"
                                 listener="#{gerenciadorAnuncioController.gravarQuantidadeVariacao(anuncio, variacao)}"
                                 update=":growl-principal"/>
                           <f:facet name="output">
                              <h:outputText value="#{variacao.availableQuantity}" />
                           </f:facet>
                           <f:facet name="input">
                              <mml:inputNumber value="#{variacao.availableQuantity}"
                                    required="true"
                                    type="integer"
                                    styleClass="Wid70px"/>
                           </f:facet>
                        </p:inplace>
                     </p:outputPanel>
                     <div class="Separator"></div>
                     <ui:repeat value="#{variacao.attributeCombinations}" var="atributo">
                        <div class="JC-FlexBox MarBot5 Fs15">
                           <h:outputText styleClass="FontLatoBold" value="#{atributo.name}: " />
                           <h:outputText value="#{atributo.valueName}" />
                        </div>
                     </ui:repeat>
                  </div>
               </p:outputPanel>
            </ui:repeat>
         </div>
      </p:rowExpansion>
   <p:dataTable>
<h:form>



If Debugged, when the inplace is clicked, the gravarQuantidadeVariacao method will have availableQuantity with the previous value, not the new one. I've reserched quite a lot about this issue, but I couldn't find anything similar. Can anyone help?

What I have tried:

So far I've tried to use different listeners and on click events, but the result is always the same.
I went through the primefaces documentation, but it provided little help a apart from the possibility to manually creating a save button inside the inplace. But that would be a patchwork on something that should/has to be working.
The current inplace/ajax call works everywhere else but here.. So I'm kind of without any ideas on what to do
Posted
Updated 5-Sep-18 9:18am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900