1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
// FONCTIONS
function fillTableEtape1(table, data){
tbody = $("<tbody>");
table.children('thead').find("td:first-child").text(data.date_num+' - '+data.date);
$.each(data, function(cle, val) {
if($.isPlainObject(val)){
// tab += '<tr><th scope="col" colspan="7" class="text-capitalize">'+cle.toUpperCase()+'</th></tr>';
tbody.append( $('<tr>').append( $('<th>').prop('colspan', 7).text(cle.toUpperCase()) ) );
$.each(val, function(cle, val) {
tbody.append(
$('<tr>')
.append( $('<td>').html(cle+'') )
.append( $('<td>').html(val.nbr+'') )
.append( $('<td>').html(val.marge+'') )
.append( $('<td>').html( Math.round(val.jrs_posit)+'' ) )
.append( $('<td>').html(val.suffixe+'') )
.append( $('<td>').html(val.nom_action+'') )
.append( $('<td>')
.html( $("<button>")
.html($("<i>").addClass("fas fa-chart-line"))
.addClass('btn btn-link btn-table p-0')
.bind('click', [val.suffixe, val.date_num ], function(event) {
console.log("ui2.0");
})
))
);
});
}
});
tbody = tbody.html().replace(/NaN/g, "--").replace(/undefined/g, "--").replace(/null/g, "--");
table.children('tbody').html(tbody);
table.click('button.btn-table',function(event) {
console.log("ui");
});
return true;
}
}); |
Partager