easyui的datagrid,接收的数据格式是json的,并且,有3个属性:rows,total,footer
其中rows是每行的数据,rows本身也是一个json数组。
total是数据总数,一般在后台是rows的数据的size();
footer是列表的页脚,一般做数据统计的时候需要用到,footer本身也是一个json数组。
具体(这里使用的是ssm框架):
1、Controller层,将查询到的数据用@ResponseBody封装为json格式返回给页面。
@RequestMapping("showtest1")
@ResponseBody
public Object showtest1(){
List<test1> list=studentService.showtest1();
System.out.println(list.get(0).getStratTime()+"dddddddddddddd");
JsonResult result = new JsonResult();
result.setRows(list);
result.setTotal(list.size());
return result;
}
2.这里的JsonResult是自定义的实体类
public class JsonResult {
private Integer total;
private Object rows;
private Object footer;
public Integer getTotal() {
return total;
}
}
别人链接:https://blog.csdn.net/wxd708854441/article/details/75026220