EasuUI-js(EasyUI formatter格式化教程) 判断常用:
1.YN标记:
formatter : function(c1, row,index) {
var a = "";
if(c1 == "Y"){
a = a + "<div style = \"background-color:00FF\"> 正确</div>";
}else if(c2 == "N"){
a = a + "<div style = \"background-color:FF0000\"> 错误</div>";
}else{
a;
}
return a;
}
2.NULL和非NULL判断 并且悬浮显示单元格内容:
//判断是否为空,若不为空显示答案并且鼠标悬浮显示
formatter : function(value, row, index) {
var a = "";
if(value == null){
}else{
return "" + value + "";
}
}
}
3.通过与不通过判断
formatter : function(value, row, index) {
var a = "";
if(value == "A"){
a = a + "<div style="background-color:#ff0" >申请中