"columnDefs":[
{
"targets":7,
createdCell:function(td,cellData,rowData,row,col){
if(cellData =='Slight'){
$(td).addClass("glyphicon glyphicon-wrench").css('color','rgb(255, 255, 0)').text('');
}else if(cellData == 'Minor'){
$(td).addClass("glyphicon glyphicon-wrench").css('color','rgb(255, 135, 0)').text('');
}else if(cellData == 'Major'){
$(td).addClass("glyphicon glyphicon-wrench").css('color','rgb(255, 0, 0)').text('');
}
}
},
]
效果由
变成: