Grazie per l'interesse ma ho risolto in questo modo
var coloreA="green";codice:var coloreA="green"; var percentualeA=0; var percentualeA1=70; var coloreB="yellow"; var percentualeB=71; var percentualeB1=99; var coloreC="red"; var percentualeC=100; var percentualeC1=1000; var myArray=[ [coloreA,percentualeA,percentualeA1], [coloreB,percentualeB,percentualeB1], [coloreC,percentualeC,percentualeC1] ]; var num; var mTabellaB = $("table > tbody > tr > td.ms-cellstyle").parent().parent().parent(); var $index = $('table > thead > tr > th.ms-vh2:contains(% Percentuale)').index()+1; for (i = 0; i < myArray.length; i++) { var $Text =$(" > tbody > tr > td:nth-child("+$index+")" , mTabellaB ).filter(function() { // Get the number and convert it to Number num = +($(this).text().split('%',1)); return num >= myArray[i][1] && num <= myArray[i][2] ; }).parent().children().css("color", myArray[i][0]); }
var percentualeA=0;
var percentualeA1=70;
var coloreB="yellow";
var percentualeB=71;
var percentualeB1=99;
var coloreC="red";
var percentualeC=100;
var percentualeC1=1000;
var myArray=[
[coloreA,percentualeA,percentualeA1],
[coloreB,percentualeB,percentualeB1],
[coloreC,percentualeC,percentualeC1]
];
var num;
var mTabellaB = $("table > tbody > tr > td.ms-cellstyle").parent().parent().parent();
var $index = $('table > thead > tr > th.ms-vh2:contains(% Percentuale)').index()+1;
for (i = 0; i < myArray.length; i++) {
var $Text =$(" > tbody > tr > td:nth-child("+$index+")" ,
mTabellaB ).filter(function() {
// Get the number and convert it to Number
num = +($(this).text().split('%',1));
return num >= myArray[i][1] && num <= myArray[i][2] ;
}).parent().children().css("color", myArray[i][0]);
}
var $index=$('table th.ms-vh2:contains(Obiettivo)').index()-1;
var $Text =$("tr").find("td.ms-cellstyle.ms-vb2:eq("+$index+")");
$Text.css("color", "RED",'important');
}

Rispondi quotando