“状态列” 数据库传递0,1
HTML:
<table id="lmsinfo" class="easyui-datagrid" title="考试管理"
style="width: auto; height: 730px;">
<thead>
<tr>
<th
data-options="field:'testname',width:fixWidth(0.2),align:'center'">考试名称
</th>
<th
data-options="field:'testpapername',width:fixWidth(0.2),align:'center'">试卷名称
</th>
<th
data-options="field:'timelimit',width:fixWidth(0.1),align:'center'">考试时长
</th>
<th
data-options="field:'begintime',width:fixWidth(0.15),align:'center'">开始时间
</th>
<th
data-options="field:'deadtime',width:fixWidth(0.15),align:'center'">截止时间
</th>
<th
data-options="field:'trainerInfo',width:fixWidth(0.1),formatter:getTrainerName,align:'center'">创建人
</th>
<th
data-options="field:'isAvailable',width:fixWidth(0.1),align:'center',formatter:getTestState " >状态
</th>
</tr>
</thead>
</table>
JS:
function getTestState(value,row,index) {
var res ='';
switch (value){
case 0:
res = '<font style="color:red;">已关闭</font>';
break;
case 1:
res = '<font style="color:green;">未关闭</font>';
break;
default:
break;
}
return res;
}
效果如下
参考博客
https://blog.youkuaiyun.com/ITBigGod/article/details/83274831