xx0cw 2020-05-16
引用自: https://www.cnblogs.com/rx124/p/10920962.html
layui表格中使用模板时需要注意
{field:‘user‘,title: ‘出卷人‘, sort: true, templet:function(d){return ‘<div>‘+d.user.username+‘</div>‘}}

在后台设置表格的json数据时,需要先把数据对象转为Object类型,否则出现重复对象时会出现 $ref 导致数据为空
JSONObject jsonObject = new JSONObject();
Object objData = JSONObject.toJSON(数据);
jsonObject.put("code", 0);
jsonObject.put("msg", "");
jsonObject.put("count", p.size());
jsonObject.put("data", objData);
response.getWriter().print(jsonObject.toString());