jQuery MiniUI

 找回密码
 立即注册
查看: 3111|回复: 3
打印 上一主题 下一主题

Struts2与miniUI集成 datagrid数据老是加载不了 [复制链接]

Rank: 1

跳转到指定楼层
楼主
发表于 2018-7-29 12:57:07 |显示全部楼层 |倒序浏览
Struts.xml:
<action name="ListEmployee" class="listEmployee">
        <result  name="success" type="json">  
      <param name="root">result</param>   

       /result>
</action>

Action:
public String execute() throws IOException {
        String hql="from EmployeeInfo e where e.leave='Y'";
        data= getEmployeeManage().listEmployee(hql, pageIndex+1, pageSize);// data为list类型
        String json=JSON.Encode(data);
        total=(int) getEmployeeManage().EmployeeCount(EmployeeInfo.class);
        result = "{\"total\":"+total+",\"data\":"+json+"}";
        System.out.println(result);
        return SUCCESS;
}


前台:
<div id="grid1" class="mini-datagrid" style="width:100%;height:95%;"
         borderStyle="border:0;" multiSelect="true"  idField="id" showSummaryRow="true" allowAlternating="true" showPager="true"   url="employee/ListEmployee">

直接这样怎么都传不过去 不过我把取到的数据result另存为txt格式的数据是可以正常加载的
另外我要是把result改为以下方式  list类型的data可以传回去datagrid可以正常加载 就是缺少数量数据
<result  name="success" type="json">  
      <param name="root">data</param>   

/result>

Rank: 1

沙发
发表于 2018-7-29 13:07:19 |显示全部楼层
就是页面老是显示在加载   也不报错

Rank: 1

板凳
发表于 2018-7-30 10:05:28 |显示全部楼层
我把后台返回的数据另存为txt格式的放到url 是可以正常加载的

Rank: 1

地板
发表于 2018-7-30 10:41:59 |显示全部楼层
"{\"total\":37,\"data\":[{\"IDCard\":null,\"QQ\":null,\"RFIDCode\":null,\"address\":null,\"birthday\":null,\"class\":\"Entity.EmployeeInfo\",\"deptId\":null,\"educationLevel\":null,\"email\":null,\"fee\":null,\"gender\":null,\"homePhone\":null,\"joinTime\":null,\"leave\":\"N\",\"leaveTime\":null,\"mobilePhone\":null,\"officePhne\":null,\"position\":null,\"schoolFrom\":null,\"sectionCode\":null,\"speciality\":null,\"staffCode\":\"NLJS345555\",\"staffName\":\"王\",\"technicalGrade\":null,\"workTime\":null,\"workType\":null}]}"

Archiver|普加软件

GMT+8, 2024-5-19 05:26 , Processed in 1.050420 second(s), 10 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部