0
私は配列をループし、データテーブルに行を追加しています。ループ中に計算される行の各セルにクラスを追加する必要があります。どのようにクラスを追加できますか?jquery datatables各セルにクラスを追加します。
table.clear()
.draw();
for(i=0;i<dbData.length;i++){
// Voice total, CSSR, DCR, MOSMS, MOSuccess, MTSMS, MTSuccess, GPRS attach, Attach success, Attach net success, PDP, PDP Success, PDP network success
// 1 2 3 4 5 6 7 8 9 10 11 12 13
colvcssr = "";
if (cdbl_if_not_null (dbData[i]['MAX(VOICECSSR)']) >= 99 && cdbl_if_not_null (dbData[i]['MAX(VOICE)']) > 0) {
colvcssr = "bg-green";
}
if (cdbl_if_not_null (dbData[i]['MAX(VOICECSSR)']) < 99 && cdbl_if_not_null (dbData[i]['MAX(VOICE)']) > 0) {
colvcssr = "bg-amber";
}
if (cdbl_if_not_null (dbData[i]['MAX(VOICECSSR)']) < 98 && cdbl_if_not_null (dbData[i]['MAX(VOICE)']) > 0) {
colvcssr = "bg-red";
}
colvdcr = '';
if (cdbl_if_not_null (dbData[i]['MAX(VOICEDCR)']) <= 075 && cdbl_if_not_null (dbData[i]['MAX(VOICE)']) > 0) {
colvdcr = "bg-green";
}
if (cdbl_if_not_null (dbData[i]['MAX(VOICEDCR)']) > 075 && cdbl_if_not_null (dbData[i]['MAX(VOICE)']) > 0) {
colvdcr = "bg-amber";
}
if (cdbl_if_not_null (dbData[i]['MAX(VOICEDCR)']) > 1 && cdbl_if_not_null (dbData[i]['MAX(VOICE)']) > 0) {
colvdcr = "bg-red";
}
colsmsmo = '';
if (cdbl_if_not_null (dbData[i]['MAX(MOSMSSUCCESS)']) >= 99 && cdbl_if_not_null (dbData[i]['MAX(MOSMSSUCCESS)']) > 0) {
colsmsmo = "bg-green";
}
if (cdbl_if_not_null (dbData[i]['MAX(MOSMSSUCCESS)']) < 99 && cdbl_if_not_null (dbData[i]['MAX(MOSMSSUCCESS)']) > 0) {
colsmsmo = "bg-amber";
}
if (cdbl_if_not_null (dbData[i]['MAX(MOSMSSUCCESS)']) < 98 && cdbl_if_not_null (dbData[i]['MAX(MOSMSSUCCESS)']) > 0) {
colsmsmo = "bg-red";
}
colsmsmt = '';
if (cdbl_if_not_null (dbData[i]['MAX(MTSMSSUCCESS)']) >= 99 && cdbl_if_not_null (dbData[i]['MAX(MTSMSSUCCESS)']) > 0) {
colsmsmt = "bg-green";
}
if (cdbl_if_not_null (dbData[i]['MAX(MTSMSSUCCESS)']) < 99 && cdbl_if_not_null (dbData[i]['MAX(MTSMSSUCCESS)']) > 0) {
colsmsmt = "bg-amber";
}
if (cdbl_if_not_null (dbData[i]['MAX(MTSMSSUCCESS)']) < 98 && cdbl_if_not_null (dbData[i]['MAX(MTSMSSUCCESS)']) > 0) {
colsmsmt = "bg-red";
}
coldattach = '';
if (cdbl_if_not_null (dbData[i]['MAX(ATTACHSUCCESS)']) >= 95 && cdbl_if_not_null (dbData[i]['MAX(ATTACH)']) > 0) {
coldattach = "bg-green";
}
if (cdbl_if_not_null (dbData[i]['MAX(ATTACHSUCCESS)']) < 95 && cdbl_if_not_null (dbData[i]['MAX(ATTACH)']) > 0) {
coldattach = "bg-amber";
}
if (cdbl_if_not_null (dbData[i]['MAX(ATTACHSUCCESS)']) < 90 && cdbl_if_not_null (dbData[i]['MAX(ATTACH)']) > 0) {
coldattach = "bg-red";
}
coldpdp = '';
if (cdbl_if_not_null (dbData[i]['MAX(PDPSUCCESS)']) >= 95 && cdbl_if_not_null (dbData[i]['MAX(PDP)']) > 0) {
coldpdp = "bg-green";
}
if (cdbl_if_not_null (dbData[i]['MAX(PDPSUCCESS)']) < 95 && cdbl_if_not_null (dbData[i]['MAX(PDP)']) > 0) {
coldpdp = "bg-amber";
}
if (cdbl_if_not_null (dbData[i]['MAX(PDPSUCCESS)']) < 90 && cdbl_if_not_null (dbData[i]['MAX(PDP)']) > 0) {
coldpdp = "bg-red";
}
coldpdpexcue = '';
if (cdbl_if_not_null (dbData[i]['MAX(PDPNETWORKSUCCESS)']) >= 95 && cdbl_if_not_null (dbData[i]['MAX(PDPNETWORKSUCCESS)']) > 0) {
coldpdpexcue = "bg-green";
}
if (cdbl_if_not_null (dbData[i]['MAX(PDPNETWORKSUCCESS)']) < 95 && cdbl_if_not_null (dbData[i]['MAX(PDPNETWORKSUCCESS)']) > 0) {
coldpdpexcue = "bg-amber";
}
if (cdbl_if_not_null (dbData[i]['MAX(PDPNETWORKSUCCESS)']) < 90 && cdbl_if_not_null (dbData[i]['MAX(PDPNETWORKSUCCESS)']) > 0) {
coldpdpexcue = "bg-red";
}
coldattachexcue = '';
if (cdbl_if_not_null (dbData[i]['MAX(ATTACHNETWORKSUCCESS)']) >= 95 && cdbl_if_not_null (dbData[i]['MAX(ATTACHNETWORKSUCCESS)']) > 0) {
coldattachexcue = "bg-green";
}
if (cdbl_if_not_null (dbData[i]['MAX(ATTACHNETWORKSUCCESS)']) < 95 && cdbl_if_not_null (dbData[i]['MAX(ATTACHNETWORKSUCCESS)']) > 0) {
coldattachexcue = "bg-amber";
}
if (cdbl_if_not_null (dbData[i]['MAX(ATTACHNETWORKSUCCESS)']) < 90 && cdbl_if_not_null (dbData[i]['MAX(ATTACHNETWORKSUCCESS)']) > 0) {
coldattachexcue = "bg-red";
}
var span = '';
if( dbData[i] ['SWITCH'].substr (0, 3) == "BSR"){
span = '<span><a href="javascript:vssalert()"><img src=../common/images/noun_5467.svg border=0 alt="Show Sites connected to this switch" style="width:15px;height:15px;opacity:0.50"></a></span>';
}else{
span = '<span><a href="sites.asp?switch='+dbData[i]['SWITCH']+'"><img src="../common/images/noun_5467.svg" border=0 alt="Show Sites connected to this switch" style="width:15px;height:15px;"></a> </span>';
}
table.row.add([
dbData[i]['SWITCH'],
'<a href="javascript:showgraphdiv(\'voicevolume'+dbData[i]['SWITCH']+'>\',\''+dbData[i]['SWITCH']+'\',\'VoiceVol\')">'+dbData[i]['MAX(VOICE)']+'</a>',
'<a href="javascript:showgraphdiv(\'voicesuccess'+dbData[i]['SWITCH']+'\',\''+dbData[i]['SWITCH']+'\',\'VoicePer\')">'+formatnumber_if_not_null(dbData[i]['MAX(VOICECSSR)'],3)+'</a>',
'<a href="javascript:showgraphdiv(\'voicedcr'+dbData[i]['SWITCH']+'\',\''+dbData[i]['SWITCH']+'\',\'VoicePer\')">'+formatnumber_if_not_null(dbData[i]['MAX(VOICEDCR)'],3)+'</a>',
'<a href="javascript:showgraphdiv(\'moattemptsms'+dbData[i]['SWITCH']+'\',\''+dbData[i]['SWITCH']+'\',\'SMSVol\')">'+dbData[i]['MAX(MOSMS)']+'</a>',
'<a href="javascript:showgraphdiv(\'mosuccesssms'+dbData[i]['SWITCH']+'\',\''+dbData[i]['SWITCH']+'\',\'SMSPer\')">'+formatnumber_if_not_null(dbData[i]['MAX(MOSMSSUCCESS)'],3)+'</a>',
'<a href="javascript:showgraphdiv(\'mtattemptsms'+dbData[i]['SWITCH']+'\',\''+dbData[i]['SWITCH']+'\',\'SMSVol\')">'+dbData[i]['MAX(MTSMS)']+'</a>',
'<a href="javascript:showgraphdiv(\'mtsuccesssms'+dbData[i]['SWITCH']+'\',\''+dbData[i]['SWITCH']+'\',\'SMSPer\')">'+formatnumber_if_not_null(dbData[i]['MAX(MTSMSSUCCESS)'],3)+'</a>',
'<a href="javascript:showgraphdiv(\'datavolumeattach'+dbData[i]['SWITCH']+'\',\''+dbData[i]['SWITCH']+'\',\'BearerVol\')">'+dbData[i]['MAX(ATTACH)']+'</a>',
'<a href="javascript:showgraphdiv(\'datasuccessattach'+dbData[i]['SWITCH']+'\',\''+dbData[i]['SWITCH']+'\',\'BearerPer\')">'+formatnumber_if_not_null(dbData[i]['MAX(ATTACHSUCCESS)'],3)+'</a>',
'<a href="javascript:showgraphdiv(\'datasuccessattach'+dbData[i]['SWITCH']+'\',\''+dbData[i]['SWITCH']+'\',\'BearerPer\')">'+formatnumber_if_not_null(dbData[i]['MAX(ATTACHNETWORKSUCCESS)'],3)+'</a>',
'<a href="javascript:showgraphdiv(\'datavolumepdp'+dbData[i]['SWITCH']+'\',\''+dbData[i]['SWITCH']+'\',\'BearerVol\')">'+dbData[i]['MAX(PDP)']+'</a>',
'<a href="javascript:showgraphdiv(\'datasuccesspdp'+dbData[i]['SWITCH']+'\',\''+dbData[i]['SWITCH']+'\',\'BearerPer\')">'+formatnumber_if_not_null(dbData[i]['MAX(PDPSUCCESS)'],3)+'</a>',
'<a href="javascript:showgraphdiv(\'datasuccesspdp'+dbData[i]['SWITCH']+'\',\''+dbData[i]['SWITCH']+'\',\'BearerPer\')">'+formatnumber_if_not_null(dbData[i]['MAX(PDPNETWORKSUCCESS)'],3)+'</a>'
]).draw();
}//end for