0
votes

I have two levels of nested datatables in the form of

<p:dataTable id="necesidades"
             value="#{registrarAccionDosBean.accionDos.necesidadesConTema}"
             rendered="#{not empty registrarAccionDosBean.accionDos.necesidadesConTema}"
             var="necesidad"
             rowKey="#{necesidad.idNecesidad}">
    <p:column style="width:16px">
        <p:rowToggler />
    </p:column>
    <p:rowExpansion>
        <h:panelGroup id="grupoTema">
            <h:panelGroup id="edicion" rendered="#{necesidad.tema.idTema ne null}">
              <p:row>
                <p:column >
                   <h:outputLabel value="#{etiq.lbl_comunes_requerido} #{etiq.etiqueta_checkbox_transparenciasFocalizadas}" styleClass="textoAcciones"/>
                </p:column>
                <p:column >
                    <!-- Nested data table -->
                    <p:dataTable id="transparenciasInplace"
                             var="transparencias" 
                             value="#{registrarAccionDosBean.transparenciasFocalizadas}"
                             selection="#{necesidad.tema.transparenciasFocalizadas}"
                             rowKey="#{transparencias.idTf}">
                        <f:facet name="header">
                            Objetives
                        </f:facet>
                        <p:column selectionMode="multiple" style="width:16px;text-align:center"/>
                        <p:column>
                            <h:outputLabel value="#{transparencias.descripcion}" styleClass="textoAccionesSmall"/>        
                        </p:column>
                    </p:dataTable>
                 </p:column>
              </p:row>
            </h:panelGroup>
        </h:panelGroup>
    </p:rowExpansion>
</p:dataTable>

I am able to retrieve the information and presented on screen properly, but when I send to submit through a command button, all the information is sending but the values of the innermost datatable(the one which id is "transparenciasInplace") are not sending in the right way, in the backing bean I getting the following information which is incorrect

The way I receive the values in the bean

  1. Subject1 ---ObjetivesE,ObjetiveF
  2. Subject2 ---null
  3. Subject3 ---null

The way that I expect and I see on screen

  1. Subject1 ---ObjetivesA (1 object subject and 1 object Objective)
  2. Subject2 ---ObjectiveB,ObjectiveC,ObjectiveD (1 object subject and 3 objects Objective)
  3. Subject3 ---ObjetivesE,ObjetiveF (1 object subject and 2 objects Objective)

The code of my command button

<p:commandButton process="@form" icon="ui-icon ui-icon-disk" id="btnsave" 
                             value="Save"                                actionListener="#registrarAccionDosBean.guardar}" 
                             widgetVar="btnguardar"
                             onclick="setTimeout('btnguardar.disable()', 10);"                                 title="#{etiq.btn_guardar}" update="content"/> 

I don't know why in the subject1 I am getting the value of the Subject3 and the values of the Subject2 and Subject3 are setting to null

1
Tried the latest pf version? Tried the 'saveState' functionality?Kukeltje
Actually, I have the latest version of primefaces, and I going to check the saveState that you suggest in order to check if I can solve my problemjam

1 Answers

0
votes

So basically I need to change my datatable to a p:selectManyCheckbox. That's because in the datatable I can not differentiate my source form my target in this particular case, because when I write

<p:dataTable id="transparenciasInplace"
                         var="transparencias" 
                         value="#{registrarAccionDosBean.transparenciasFocalizadas}"
                         selection="#{necesidad.tema.transparenciasFocalizadas}"
                         rowKey="#{transparencias.idTf}">
                    .
                    .

The value that is sending is my source and this is shared between the n rows and I think there was the problem, but if we use something like this

  <p:selectManyCheckbox id="transparenciasInplace" value="#{necesidad.tema.transparenciasFocalizadas}" layout="pageDirection" columns="1" converter="transparenciaConverter" style="table-layout: auto;font-weight: bold; text-align:  justify;font-size :15px">
                        <f:selectItems value="#{registrarAccionDosBean.transparenciasFocalizadas}" var="transparenciaC" itemLabel="#{transparenciaC.descripcion}" itemValue="#{transparenciaC}" />
  </p:selectManyCheckbox>

I clearly separete my source

<f:selectItems value="#{registrarAccionDosBean.transparenciasFocalizadas}" var="transparenciaC" itemLabel="#{transparenciaC.descripcion}" itemValue="#{transparenciaC}" />

from the target (the value that I want to send)

<p:selectManyCheckbox id="transparenciasInplace" value="#{necesidad.tema.transparenciasFocalizadas}" layout="pageDirection" columns="1" converter="transparenciaConverter" style="table-layout: auto;font-weight: bold; text-align:  justify;font-size :15px">