0
I need to change the color of the table row according to the date that appears. Equal dates need to have equal colors. It is system that registers when the employee hits the point.
data_inicial = result.apontamentos[0].data;
$.each(result.apontamentos, function(i) {
var newRow = $("<tr>");
var cols = "";
if(data_inicial == result.apontamentos[i].data){
cols += '<td class="cor_sim"></td>';
//formatando a data
var arrayData = result.apontamentos[i].data;
var arr = arrayData.split('-');
var data = arr[2] + "/" + arr[1] + "/" + arr[0];
cols += '<td class="cor_sim">' + data +'</td>';
cols += '<td class="cor_sim">' + result.apontamentos[i].hora + '</td>';
cols += '</td>';
newRow.append(cols);
$("#apontamentos").append(newRow);
}else{
cols += '<td class="cor_nao"></td>';
//formatando a data
var arrayData = result.apontamentos[i].data;
var arr = arrayData.split('-');
var data = arr[2] + "/" + arr[1] + "/" + arr[0];
cols += '<td class="cor_nao">' + data +'</td>';
cols += '<td class="cor_nao">' + result.apontamentos[i].hora + '</td>';
cols += '</td>';
newRow.append(cols);
$("#apontamentos").append(newRow);
}
});
In the case of the image, the date 18/05 should also have color.
Dates are always ordered in sequence or may have different dates interspersed?
– Sam
The dates then always in descending and ordered order. It is a system to register the time an employee hits the point. Then you will have days that will not have notes (Saturday or Sunday, for example).
– deborahfonseca