Struts2 - Iteration by 2 list , but show data of second list after click popup

26 Views Asked by At

I'm having problems showing the data from the second list when I click on the popup, as no data appears.

What happens is that I have a list of specialties "tiposEspecialidadeGrupo" and within this list I have another list of articles "ArtigosView", because for each specialty I have several articles. But the articles are shown in a popup when clicking icon "plus.gif"."

I think the problem is when I'm iterating over the second list, somehow <s:iterator value="#grupoTiposEspecialidade.ArtigoView" var="artigo"> this code doesn't work.

I have the following code:

To present the list of specialties:

    <a name="especialidades"></a>
    <table class="tablaForm">
        <tbody>
            <s:url var="srcImg" value="/img/plus.gif"/>
            <s:set var="indice" value="%{0}" />
            <s:iterator value="tiposEspecialidadeGrupo" var="grupoTiposEspecialidade" status="status">
            <s:if test="%{#indice == 0}">${'<tr>'}</s:if>
            <td>
                <s:a href="#especialidades">
                    <div class="grupoEspecialidade" id="especialidades_${indice}">
                        <s:set var="isChecked" value="isChecked" />
                        <input id="checkbox_${indice}" onclick="handleCheckbox(this)"
                           type="checkbox"
                           name="codigosEspecialidades"
                           value="<s:property value='codigo'/>"
                               <s:if test="%{codigo in codigosEspecialidades}">
                                   checked = "checked"
                               </s:if>
                           />
                        <s:property value="nombre"/>
                        <!-- Check if tiposEspecialidadeGrupo.ArtigoView is not empty -->
                        <s:if test="%{ArtigoView != null}">
                            <img src="<s:url value='/img/cliente/icono_editar.png'  />" onclick="openPopupArtigos" alt="<s:text name='comun.texto.modificar'/>"/>
                        </s:if>
                        <s:else>
                            <img src="<s:url value='/img/plus.gif'/>" alt="Plus" onclick="openPopupArtigos()"/>
                        </s:e
                    </div>
                </s:a>
            </td>
            <s:set var="indice" value="%{#indice + 1}" />
            <s:if test="%{#indice % 4 == 0}">${'</tr><tr>'}</s:if>
            </s:iterator>
            <%-- Vexo si existe resto para poñer o que falta --%>
            <s:if test="%{#indice % 4 != 0}">
                <td colspan="<s:property value="%{#indice % 4}"/>"></td></tr>
            </s:if>
        </tbody>
    </table>

call popup

function openPopupArtigos(checkbox) {
    $("#popupArtigos").dialog("open");
}


popup to show data of second list
 <!-- popupArtigos -->
<div class="dialogArtigos">
    <sj:dialog id="popupArtigos"
               autoOpen="false"
               modal="true"
               title="nome da especialidade"
               width="600"
               height="auto"
               buttons="{'Guardar': function() {
             $(this).dialog('close');
           },
            'Fechar': function() {$(this).dialog('close');}
            <s:iterator value="#grupoTiposEspecialidade.ArtigoView" var="artigo">
                <tr>
                    <td><s:property value="#artigo.descripcionEspecialidadArtigo"/></td>
                    <td><s:property value="#artigo.cantidadEspecialidadArtigo"/></td>
                </tr>
            </s:iterat
    </sj:dialog>
</div>

<script>
    function addRow() {
        var newRow = '<tr>' +
            '<td><input type="text" name="columnA" /></td>' +
            '<td><input type="text" name="columnB" /></td>' +
            '<td><input type="text" name="columnC" /></td>' +
            '<td><img src="<s:url value='/img/plus.gif'/>"/></td>' +
            '</tr
        $('#myTable tbody').append(newRow);
        return false;
    }
</script>
0

There are 0 best solutions below