Get parameter in .click same as inclick - jQuery

0

I have the following iterator that has delete buttons that are loaded dynamically:

<s:iterator value="form.listaCooperativa" id="lista" status="lista_status">
    <s:if test="#lista_status.odd == true">
        <tr>
    </s:if>
    <s:else>
        <tr class="linha-alternada">
    </s:else>
    <td align="center">
        <s:a href="javascript:;" onclick="abrirFormAlterar('%{idCooperativa}');" title="Alterar">
            <s:property value="pessoaJuridica.nrCpfCnpjFormatado" />
        </s:a>
    </td>
    <td align="left"> <s:property value="pessoaJuridica.nmEmpresarial" /></td>
    <td align="left"> <s:property value="apelido[0].nmApelido" /></td>
    <td align="center">
        <sisprocer:botao key="mantercooperativa.label.button.excluir" title="Excluir" id="excluir-dialog-confirm-link"/>
    </td>
</s:iterator>

These delete buttons open a dialog:

function configuraPopups(){
    $('#excluir-dialog-confirm').dialog({
        autoOpen  :false,
        modal    :true,
        resizable :false,
        buttons: {
            "Cancelar": function() { 
                $(this).dialog("close"); 
            }, 
            "Ok": function() {
                $(this).dialog("close");  
                //excluir(idCooperativa) QUERO ENVIAR O ID AQUI!
            } 
        }
    });

    // Dialog confirm link
    $('#excluir-dialog-confirm-link').click(function(){
        var id = $(this).attr('%{idCooperativa}'); //QUERO RECEBER O ID AQUI
        $('#excluir-dialog-confirm').dialog('open');
        return false;
    });

}

But I would like to get the idCooperative in the related object dialog, just as if you were sending for example = onClick ('% {idCooperative}');

I have problems using onClick because the button is already standardized to submit due to the framework, ie I need to recover this way so that I could send to the method related to the parameter by clicking ok, such as:

"Ok": function() {
    $(this).dialog("close");  
    excluir(idCooperativa);
} 

How do I get this parameter in this location? Remember that for each button I have a different id.

    
asked by anonymous 22.11.2018 / 20:25

1 answer

0

Stenio, you can get the click event on the function as a parameter and from it use the preventDefault () function to prevent Submit behavior from occurring. Then you can do the manipulation that you want.

link

    
22.11.2018 / 20:48