Currently I go through an array and I show data in a table, dynamically, what happens to me is that it inserts all the values in the last row of the table and skips the first one, in what way can I do so that the Do you insert data from the first row to the last?
$.each(objView.ArrayStock, function(indice, elemento) {
$.each(elemento, function(indice2, elemento2) {
$("#table1 td:last").before('<td>'+elemento2.STOCK_REAL+'</td>');
/* uso el last para insertarlo entre dos columnas */
})
});
This is my table, I need to insert the array data between two columns of my previously built table.
<table id="table1">
<thead>
<tr>
<th>Descripción</th>
<th>Codigo</th>
<th>Precio</th>
<th>Eliminar</th>
</tr>
</thead>
<tbody>
<tr >
<td>LIQUIDO DE FRENO
</td><td>08852</td>
/*entre estas dos columnas necesito ingresar los datos del array/*
<td>45000</td>
</tr>
<tr>
<td>LIQUIDO DE FRENO</td>
<td>05215</td>
/*entre estas dos columnas necesito ingresar los datos del array*/
<td>44000</td>
</tr>
</tbody>
</table>
My problem is that all the data in the array is inserted in the last example column of my error:
<tbody>
<tr >
<td>LIQUIDO DE FRENO
</td><td>08852</td>
<td>45000</td>/*aca deberian ir datos pero se la salta la primera fila*/
</tr>
<tr>
<td>LIQUIDO DE FRENO</td>
<td>05215</td>
<td>44000</td>
<td>dato insertado</td>/* se insertan en el ultimo tr del body y se salta la primera fila de mi tabla */
<td>dato insertado</td>
<td>dato insertado</td>
<td>dato insertado</td>
</tr>
</tbody>
Thanks for your attention greetings.