0
Take a look at the scenery:
I have the following array’s
let arr = [23,0,0]
let coresLinhasPorPocsag = ["#4d79ff", "#ff6600", "#00cc88", "#b31aff"]
I need to pick the color according to the position of the array arr
I can pick up the first color, but when it passes again on it returns with undefined
someone can help me find the mistake ?
Example:
arr[0] = 23
coresLinhasPorPocsag[0] = "#4d79ff"
Upshot = 23 in color "#4d79ff"
arr[1] = 0
coresLinhasPorPocsag[1] = "#ff6600"
Upshot = 0 in color "#ff6600"
And so on and so forth.
Follows code:
"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
}
},
I can’t understand your doubt, if I explain it better I’ll find a way to help you.
– Marconi
@Marconi I need to associate the color array index with the list array index. I edited the question with example
– Igor Carreiro
...
+ coresLinhasPorPocsag[i]
?– bfavaretto
@bfavaretto already tried, it didn’t work... because on arra[i] will be the number of the list and not its vector ;s
– Igor Carreiro
I edited it, wouldn’t it
+ coresLinhasPorPocsag[i]
?– bfavaretto
@bfavaretto truth, I wanting to do some very 'beautiful' I ended up running away from the simple, just pass the contactor... It worked.
– Igor Carreiro