Dialog with dataTable is not displayed

0

I have a dialog with a dataTable , but clicking the button that should open it does not happen.

It also has a dataTable inside it that should have values corresponding to the line in which it corresponds to dataTable . Could you tell me why this occurs?

<p:commandButton value="Buscar" action="#{ocorrenciaViewMB.obterOcorrencia}" ajax="true" update=":form"></p:commandButton>
    <p:dataTable var="ocorrencia" value="#{ocorrenciaViewMB.listaocorrencia}" emptyMessage="Nenhuma ocorrência de risco encontrada." widgetVar="riscoTabela" sortMode="multiple" draggableColumns="true"
     draggableRows="true" resizableColumns="true" caseSensitiveSort="false">
        <f:facet name="header">
            <p:outputPanel>     
                <h:outputText value="#{msgs.OcorrenciasDeRisco}" />            
            </p:outputPanel>
        </f:facet>
        <p:column headerText="#{msgs.Codigo}" colspan="1"
                 sortBy="#{ocorrencia.codigo}">
            <h:outputText value="#{ocorrencia.codigo}" />
        </p:column>
        <p:column style="width:32px;text-align: center">
            <p:commandButton  value="Modal" type="button"  oncick="PF('modal').show();" />
        </p:column>
        <p:dialog header="Danos" closeOnEscape="true" showEffect="fade" position="center" hideEffect="explode" widgetVar="modal"  id="modal" modal="true" height="50">
            <p:dataTable var="dano"  id="dataTableDano" value="#{ocorrencia.listaDeDanos}" emptyMessage="Nenhum encontrado." sortMode="multiple" draggableColumns="true" draggableRows="true" resizableColumns="true" caseSensitiveSort="false">
                <h:outputText value="Código" />
                <h:outputText value="#{dano.codigo}" />
                <h:outputText value="Descrição" />
                <h:outputText value="#{dano.descricao}" />
            </p:dataTable>
        </p:dialog> 
    </p:dataTable>
    
asked by anonymous 01.11.2015 / 15:34

1 answer

0

Pass <p:Dialog out of </p:dataTable> then change onClick to oncomplete="PF('modal').show()"

Your code will look like this. Take the test and see if it works that way.

    <p:commandButton value="Buscar" action="#{ocorrenciaViewMB.obterOcorrencia}" ajax="true" update=":form"></p:commandButton>
        <p:dataTable var="ocorrencia" value="#{ocorrenciaViewMB.listaocorrencia}" emptyMessage="Nenhuma ocorrência de risco encontrada." widgetVar="riscoTabela" sortMode="multiple" draggableColumns="true"
         draggableRows="true" resizableColumns="true" caseSensitiveSort="false">
            <f:facet name="header">
                <p:outputPanel>     
                    <h:outputText value="#{msgs.OcorrenciasDeRisco}" />            
                </p:outputPanel>
            </f:facet>
            <p:column headerText="#{msgs.Codigo}" colspan="1"
                     sortBy="#{ocorrencia.codigo}">
                <h:outputText value="#{ocorrencia.codigo}" />
            </p:column>
            <p:column style="width:32px;text-align: center">
                <p:commandButton  value="Modal" type="button"  oncomplete="PF('modal').show();" />
            </p:column>

        </p:dataTable>

<p:dialog header="Danos" closeOnEscape="true" showEffect="fade" position="center" hideEffect="explode" widgetVar="modal"  id="modal" modal="true" height="50">
                <p:dataTable var="dano"  id="dataTableDano" value="#{ocorrencia.listaDeDanos}" emptyMessage="Nenhum encontrado." sortMode="multiple" draggableColumns="true" draggableRows="true" resizableColumns="true" caseSensitiveSort="false">
                    <h:outputText value="Código" />
                    <h:outputText value="#{dano.codigo}" />
                    <h:outputText value="Descrição" />
                    <h:outputText value="#{dano.descricao}" />
                </p:dataTable>
            </p:dialog> 

Test by setting modal="false" and see if it works as well.

    
15.07.2016 / 20:28