Look at the scenario:
I have the following array's
let arr = [23,0,0]
let coresLinhasPorPocsag = ["#4d79ff", "#ff6600", "#00cc88", "#b31aff"]
I need to get the color according to the position of the array arr
I can get it from the first color, but when it goes back on it it returns with undefined
can anyone help me find the error?
Example:
arr[0] = 23
coresLinhasPorPocsag[0] = "#4d79ff"
Result = 23 in color "# 4d79ff"
arr[1] = 0
coresLinhasPorPocsag[1] = "#ff6600"
Result = 0 in color "# ff6600"
And so on.
Follow the code below:
"data": "somatoriaEcmUltimas24h",
"render": function (data, type, row) {
let linha = ''
let coresLinhasPorPocsag = ["#4d79ff", "#ff6600", "#00cc88", "#b31aff"]
let arr = (data.split(','))
for (var i = 0; i < arr.length; i++) {
linha += "<div class='row' style='color:'" + coresLinhasPorPocsag[arr[i].indexOf(arr[i].length)] + "'>" + arr[i] + "</div>"
}
return linha
}
},