<table id="mainTable" name="mainTable" class="easyui-datagrid" title="附件" style="width: 99%;"
data-options="rownumbers:true,singleSelect:true,url:'My_Homework_Detail_Atta.ashx?hid=<%=Request["id"] %>',method:'get' ">
<thead>
<tr>
<th data-options="field:'JSON_file_path',resizable:true,formatter:formatFileName " style="width: 80%">名称</th>
<th data-options="field:'_operate',width:80,align:'center',formatter:formatOper " style="width: 20%">删除</th>
</tr>
</thead>
</table>
function formatFileName(val, row) {
var strs = val.split("/");
var len = strs.length;
return '<a href="/'+val+'"> ' + strs[len-1] + ' </a>';
}
而实际这个字段的值为:
School/HomeWork/HomeWork_Docs/7207/新建文本文档_2018102812944.txt
经过格式化后显示为一个超链接。