$('#dg').datagrid({
columns:[[
{field:'id', hidden:true},
{field:'questionContent',title:'题干'},
{field:'degree',title:'难度等级',
formatter:function(value,rec){
if(value==2){
return '中等';
}
else if(value==3){
return "困难";
}
else {
return "简单";
}
}
},
{field:'score',title:'分值'}
]],
type : 'post',
url : '${pageContext.request.contextPath}/queryQuestionMain?courseId='+ courseId + '&questionTypeId=' + questionTypeId + '&conditions='+conditions,
});
<table id="dg" class="easyui-datagrid" style="width: 100%; height: 450px" toolbar="#toolbar" pagination="true" fitColumns="true" rownumbers="true" data-options="onRowContextMenu:onRowContextMenu">
<thead>
<tr>
<th data-options="field:'ck',checkbox:true"/>
<th field="id" hidden="true"/>
<th field="questionContent" width="70%" align="center">题干</th>
<th field="degree" formatter=formatDegree width="10px" align="center">难度等级</th>
<th field="score" style="width:10px;aglin:center;" align="center">分值</th>
<!-- <th style="width: 80px" class="easyui-linkbutton"data-options="field:'_operator',width:50,algn:'center',formatter:formatReOper">修改</th> -->
<th data-options="field:'_operator',align:'center',formatter:formatReOper">编辑</th>
</tr>
</thead>
</table>
function formatDegree(value,rec)
{
if(value==2){
return '中等';
}
else if(value==3){
return "困难";
}
else {
return "简单";
}
}