I have a table created automatically from data in database.
var rows = "";
rows += "<tr class='row_primary'>";
rows += "<td>COL 1</td>";
rows += "<td>COL 2</td>";
rows += "<td>COL 3</td>";
rows += "</tr>";
$.each(data.db_values, function(i, results){ //This is from database with n rows depend on n results
rows += "<tr class='row_secondary'>";
rows += "<td>COL 1</td>";
rows += "<td>results.ID</td>";
rows += "<td>COL 3</td>";
rows += "</tr>";
});
$('#t_barang tbody').append(rows);
My idea is to adding rowspan after the table is created. But, it seems not working as it should be. I tried adding $('#t_barang tbody tr').attr('rowspan', '5'); for a 5 row table. But, it is not change the table.
current result:
COL1 COL2 COL3
COL1 DATA1 COL3
COL1 DATA2 COL3
COL1 DATA3 COL3
COL1 DATA4 COL3
Expected result:
COL2
DATA1
COL1 DATA2 COL3
DATA3
DATA4