后台返回的json格式;
列表字段要显示username 用户的真实姓名;
formatter="formatterByUserName"
<table id="dg"class="easyui-datagrid" style="100%;height:auto;" url="<%=basePath %>notice/listByPage" toolbar="#toolbar" pagination="true" title="公告管理" rownumbers="true" fitColumns="true" singleSelect="true"> <thead> <tr> <th field="title" width="50">标题 </th> <th field="content" width="50">内容</th> <th field="createDate" width="50">创建时间</th> <th field="user" width="50" formatter="formatterByUserName">用户</th> </tr> </thead> </table>
<script type="text/javascript"> function formatterByUserName(val,row){ if(val==null){ return ""; } return val.username; } </script>