JSF <p:commandLink> action is not invoked

Asked

Viewed 165 times

0

Good evening, everyone,

I have a problem, I have a commandoLink in a table that when clicked, does not invoke the method of a Bean that is in its action, I have seen some solutions like put ajax="false", but I can not update the page and with ajax="false" the page is updated.

The code of the xhtml page:

<h:form id="formBusca">
                 <h:panelGrid columns="5">
                    <h:outputLabel value="CPF&nbsp;do&nbsp;Dono: " for="cpf" />
                    <p:inputMask id="cpf" label="CPF" required="true" value="#{animalController.animal.dono.cpf}" mask="999.999.999-99" style="margin-left: 8%;" converter="cpfConverter">
                        <f:validator validatorId="cpfValidator"/>
                    </p:inputMask>
                    <p:commandButton id="buscar" ajax="false" action="#{animalController.buscarAnimais()}" style="margin-left: 50%;" value="Buscar"/>
                </h:panelGrid>
                <br /><br />
                <center>
                    <p:dataTable var="animal" value="#{animalController.animais}">                            
                        <p:column headerText="Nome">
                            <h:outputText value="#{animal[0]}" />
                        </p:column>

                        <p:column headerText="Tipo">
                            <h:outputText value="#{animal[1]}" />
                        </p:column>

                        <p:column headerText="Porte">
                            <h:outputText value="#{animal[2]}" />
                        </p:column>

                        <p:column headerText="Raça">
                            <h:outputText value="#{animal[3]}" />
                        </p:column>

                        <p:column headerText="Idade">
                            <h:outputText value="#{animal[4]}" />
                        </p:column>

                        <p:column headerText="Sexo">
                            <h:outputText value="#{animal[5]}" />
                        </p:column>

                        <p:column headerText="Nome do Plano do Animal">
                            <h:outputText value="#{animal[6]}" />
                        </p:column>

                        <p:column headerText="Nível do Plano do Animal">
                            <h:outputText value="#{animal[7]}" />
                        </p:column>

                        <p:column headerText="Valor do Plano do Animal">
                            <h:outputText value="#{animal[8]}" />
                        </p:column>

                        <p:column>
                            <p:commandLink value="Vincular Plano" action="#{planoController.planosSugeridos(animal)}" oncomplete="PF('modal').show();"/>
                        </p:column>
                    </p:dataTable>
                </center>

                <p:dialog id="modalSugeridos" header="Planos sugeridos" widgetVar="modal" modal="true" height="500" width="1000">
                    <p:dataTable var="plano" value="#{planoController.planos}">

                        <p:column headerText="ID do Plano">
                            <h:outputText value="#{plano.id}" />
                        </p:column>

                        <p:column headerText="Nome do Plano">
                            <h:outputText value="#{plano.nome}" />
                        </p:column>

                        <p:column headerText="Nível do Plano">
                            <h:outputText value="#{plano.nivelPlano}" />
                        </p:column>

                        <p:column headerText="Valor do Plano">
                            <h:outputText value="#{plano.valorPlano}" />
                        </p:column>

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

The Managedbean method code:

public void planosSugeridos(Object[] o){

    Plano p = new Plano(o[1].toString(),o[2].toString(),o[4].toString());

    planos = planoDA.planosSugeridos(p);
}

Thanks for your help and attention, good evening.

  • Already tried adding a process="@this" to commmandlink?

1 answer

0

From what I saw, you need to open a modal after the method, then try using this command and put the modal form id as parameter

Tries update="@seuform"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.