1

i have a problem with JSF commandlink inside ui:repeat with a subtable/datatable.

I already trie use a viewscoped bean with @PostConstruct method loading all data and still not working.

I read @BalusC explanation in commandButton/commandLink/ajax action/listener method not invoked or input value not updated and still not work.

My xhtml:

    <p:column style="text-align:left;">                         
            <p:imageSwitch effect="fade" id="fadeEffect">
                <ui:repeat value="#{item.evidenciaRespostaAsList}" var="image" id="fadeEffectImages">

                    <!-- this commandlink is working as expected -->
                    <p:commandLink update=":form:dlgImage :form:messages :form:msgs" action="#{relatorioAuditoriaViewScopedMBean.setSelectedItem(item)}" oncomplete="PF('dlg').show()">

                    <p:graphicImage value="#{fotoMBean.foto}" width="150" height="100" >
                        <f:param name="fotoNome" value="#{image.descricao}" />
                        <f:param name="fotoType" value="#{image.filetype}" />
                    </p:graphicImage>                                                                               

                    </p:commandLink>
                </ui:repeat>
            </p:imageSwitch>                            
    </p:column>

     <f:facet name="footer">
        <p>Evidências Obrigatórias: #{resposta.produto.descricao} #{resposta.linha.descricao} (#{resposta.evidenciaObrigatoriaList.size()}) </p>
        <p:column>
        <div id="main" class="flex-centralizado">

                <ui:repeat value="#{resposta.evidenciaObrigatoriaList}" var="imagemEvidenciaObrigatoria" id="fadeEffectImagesEvidenciaObrigatoria">

                    <div class="figura">                                                
                            <p>#{imagemEvidenciaObrigatoria.tipoEvidencia.descricao}</p>                                                
                            <p>                         <p:commandLink                                                          
                                    rendered="true"                                                  
                                    update=":form:dlgImageObrigatoria :form:messages :form:msgs" 
                                    action="#{relatorioAuditoriaViewScopedMBean.setSelectedEvidenciaObrigatoria(imagemEvidenciaObrigatoria)}"
                                    actionListener="#{relatorioAuditoriaViewScopedMBean.atualizarFotoEvidenciaObrigatoria}" 
                                    oncomplete="PF('dlgE').show()">

                                    <f:param name="idevidenciaObrigatoria" value="#{imagemEvidenciaObrigatoria.idevidenciaAuditoria}"/>                                                                                                                 

                                    <p:graphicImage rendered="true" value="#{fotoMBean.foto}" width="150" height="100" >
                                        <f:param name="fotoNome" value="#{imagemEvidenciaObrigatoria.descricao}" />
                                        <f:param name="fotoType" value="#{imagemEvidenciaObrigatoria.filetype}" />
                                    </p:graphicImage>                                                   
                                </p:commandLink>
                            </p>                                                                                                                        
                    </div>
                </ui:repeat>

        </div>
        </p:column>                 
    </f:facet>

My bean is ViewScoped and all getters and setters are default. My only problem is that the second commandlink inside facet:footer dont invoke action or actionlistener or update. Dialog called oncomplete is loading without data.

@Action Method

    public void setSelectedEvidenciaObrigatoria(EvidenciaAuditoria selectedEvidenciaObrigatoria) {
        this.selectedEvidenciaObrigatoria = selectedEvidenciaObrigatoria;
    }

@ActionListener Method

    public void atualizarFotoEvidenciaObrigatoria(javax.faces.event.ActionEvent event) {
        LOGGER.info("atualizarFotoEvidenciaObrigatoria() called!");


        String idevidenciaObrigatoria = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("idevidenciaObrigatoria");
        int id = Integer.parseInt(idevidenciaObrigatoria);

        LOGGER.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> idevidenciaObrigatoria="+id+" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");

    }

more details:

  • PF 5.2 with Mojarra 2.1.7.
  • only one h:form with id
  • i already tried with sessionscoped and request scoped
  • i already tried with nested forms
  • i already tried with/without p:columns
  • i already tried with a panel before repeat
  • i haven't js erros or exceptions

Any sugestions?

Ty for help!

Community
  • 1
  • 1
Oliveira
  • 11
  • 2
  • Beside the BalusC post, also read [ask] and [mcve] – Kukeltje Oct 19 '15 at 22:14
  • after few hours trying to resolve. i've decided remove p:datable and p:subtable. My workaround was replace datable/sutable by nested ui:repeat with normal tables (html table/thead/tbody/td/tr). i know that solution isn't elegant, but, after a deep look at source-code. i realized that something was missing on code generated by datable and sutable. – Oliveira Oct 20 '15 at 16:17

0 Answers0