I have a loop generated table that fills its rows using an object array retrieved from a database query.
This is the coda that generates the table
indices = ["razonSocial", "nombre1", "telefonoFijo1", "telefonoMovil1", "correoElectronico1", "clave"];
indiceBotones = ["id"];
var selectArray = [];
jQuery.each(returned.listaproveedorfamilia, function(i, val) {
selectArray.push({
"id": val.id,
"razonSocial": val.razonSocial,
"nombre1": val.nombre1,
"telefonoFijo1": val.telefonoFijo1,
"telefonoMovil1": val.telefonoMovil1,
"correoElectronico1": val.correoElectronico1,
"clave": val.clave
});
});
$.each(selectArray, function(i, selected) {
var tr = $('<tr>');
$.each(indices, function(i, indice) {
$('<td>').html(selected[indice]).appendTo(tr);
});
$.each(indiceBotones, function(i, indiceBoton){
//Here I need to add the code for the two buttons in the same cell
});
tbody.append(tr);
});
And I want it to have buttons like this in the last column
This is an example of the code generated by the loop for every row
<tr>
<td>00020</td>
<td>00020</td>
<td>00020</td>
<td>00020</td>
<td>00020</td>
<td>PCR</td>
</tr>
After the last td, and additional td should be added containing the following tags
<td>
<a title="Editar" href="<?php echo site_url('proveedor/edit/' HERE GOES THE VALUE OF THE ID selected[indiceBoton]); ?>" class="btn btn-info btn-xs"><span class="fa fa-pencil"></span></a>
<a title="Eliminar" href="<?php echo site_url('proveedor/remove/'HERE GOES THE VALUE OF THE ID selected[indiceBoton]); ?>" class="btn btn-danger btn-xs"><span class="fa fa-trash"></span></a>
</td>
So for every row, the following code shoud be created
<tr>
<td>00020</td>
<td>00020</td>
<td>00020</td>
<td>00020</td>
<td>00020</td>
<td>PCR</td>
<td>
<a title="Editar" href="<?php echo site_url('proveedor/edit/' HERE GOES THE VALUE OF THE ID selected[indiceBoton]); ?>" class="btn btn-info btn-xs"><span class="fa fa-pencil"></span></a>
<a title="Eliminar" href="<?php echo site_url('proveedor/remove/'HERE GOES THE VALUE OF THE ID selected[indiceBoton]); ?>" class="btn btn-danger btn-xs"><span class="fa fa-trash"></span></a>
</td>
</tr>
How could I modify the loop to generate these tags? Thanks for your help.


<td><button></button></td>after the inner$.eachloop that is fetching indices.