Error when listing data in Dialog of the Primefaces

1

Clicking comandButonn is loading the last video in the list in dialog , but datatable works correctly when viewed by component media . I want to make it easy for the user as follows:

When the user clicks the abrir o dialog button, display the video of the X registry within dialog and click on the second button to open the Y video. I think it's a simple thing, but I can not configure it. I'm finding it strange because it only shows the last video (It seems that it's not updating painel in comandButonn . I try update=":mensagem :formListagem:tabela formVideo:painelVideo") .

Here are some snippets of the code:

Datatable (Primefaces):

                    <p:commandButton value="Assistir"
                        oncomplete="PF('video').show();"
                        actionListener="#{logicaAlgoritmoBean.selecionarVideo}"
                        update=":mensagem :formListagem:tabela formVideo:painelVideo" >
                        <f:attribute name="videoSelecionado" value="#{logicaAlgoritmo}" />
                    </p:commandButton>

                    <p:dialog header="Vídeo Aula" widgetVar="video"                         
                        position="top" 
                        draggable="true" resizable="true" modal="true">                         
                        <h:form id="formVideo"> 
                            <h:panelGrid id="painelVideo">                      

                                <p:outputLabel id="nomeCurso" maxlength="600" size="40"
                                value="#{logicaAlgoritmoBean.logicaAlgoritmo.curso.nomeCurso}" />

                                <p:outputLabel id="descricao" maxlength="600" size="40"
                                value="#{logicaAlgoritmoBean.logicaAlgoritmo.descricao}" />

                                <p:media cache="false" id="videos"
                                    value="http://localhost:8080/logica/#{logicaAlgoritmo.codigo}.wmv" 
                                    width="910px" 
                                    height="450px" player="windows">    
                                    <f:param name="autoPlay" value="true" />
                                    <f:param name="autostart" value="true" />                       
                                </p:media>                              

                            </h:panelGrid>
                        </h:form>                                                           
                    </p:dialog>

/ Here the average component correctly displays the video of each record. /

                    <p:media cache="false" id="videos" value="http://localhost:8080/logica/#{logicaAlgoritmo.codigo}.wmv" width="200" 
                        height="150" player="windows">  
                        <f:param name="autoPlay" value="false" />
                        <f:param name="autostart" value="false" />                      
                    </p:media>
                </p:column> 

SelectVideo method, to show the video that was chosen on the console:

public void selecionarVideo(ActionEvent evento){
        logicaAlgoritmo = (LogicaAlgoritmo) evento.getComponent().getAttributes().get("videoSelecionado");
        System.out.println("Vídeo selecionado: "+logicaAlgoritmo);

    }

Method to list:

@PostConstruct
    public void listar() {
        try {
            logicaAlgoritmoDAO logicaAlgoritmoDAO = new logicaAlgoritmoDAO();
            logicaAlgoritmos = logicaAlgoritmoDAO.listar();
        } catch (RuntimeException erro) {
            Messages.addGlobalError("Ocorreu um erro ao tentar listar a vídeo aula!");
            erro.printStackTrace();
            Messages.addGlobalError(erro.getMessage());
        }
    }
    
asked by anonymous 25.09.2016 / 22:06

0 answers