0
I have the following iterator that has delete buttons that are dynamically loaded:
<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, as if it were sending for example = onClick('%{idCooperative}');
I have problems using onClick because the button is already standardized for Submit due to the framework, that is, I need to recover this way so that I could send the method related to the parameter when clicking ok, as for example:
"Ok": function() {
$(this).dialog("close");
excluir(idCooperativa);
}
How can I receive this parameter in this location? Remembering that for each button I have a different id.
That one
id="excluir-dialog-confirm-link"
is generated multiple times? Cannot generate repeated id’s.– Sam
Friend I’ll give you rich advice: Exchange these IDS for class. in class you take the value, take the id, take what you want.
– Risk
@Sam, truth hadn’t thought of it, but there was no sign of error on that, which you think would be a good solution?
– Stenio Vilar
@Riscadooooooerabiscadoo problem that is legacy system and should be maintained standardization.
– Stenio Vilar
If you put two repeat Ids at the end of the project... you will have a ghost legacy.
– Risk
Go to www.meuposto.ml/1.html to try to help you
– Risk
No error, but repeating id’s causes problems. If vc cannot change this, you can select the button by another attribute, type
$("#lista [title=Excluir]")
– Sam