liane530 2015-01-19 03:28 采纳率: 0%
浏览 2189

Spring MVC easyui1.3.2 datagrid无法加载数据

 jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/page/jqueryMaster.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>

    <script type="text/javascript" src="<%=root%>/info/js/infoList.js"  charset="utf-8"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <title>信息列表</title>
  </head>

  <body>
    <!-- 列表 -->
    <table id="tt">
    </table>

    <!-- 工具拦 -->
    <div id="tb" style="padding: 3px">
        <form method="post" action="" id="myForm" name="myForm">
            <br> 
            <span>信息标题:</span> <input id="ensurname" name="ensurname" style="width:160px; border: 1px solid #ccc">
            <span>创建人:</span> <input id="engivename" name="engivename" style="width:160px; border: 1px solid #ccc">
            <span>创建时间:</span> <input name="asampletbl.birthday" id="abirthday" class="easyui-datebox" currentText='今天' closeText='关闭' formatter="formatDate">
            <a href="#" class="easyui-linkbutton" iconAlign="right" data-options="iconCls:'icon-search'" onclick="doSearch()">查询</a>
            <a href="#" class="easyui-linkbutton" iconAlign="right" data-options="iconCls:'icon-undo'" onclick="Javascript:$('#tb').form('clear')">清空</a>
            <!-- 
            <a href="#" class="easyui-linkbutton" iconAlign="right" data-options="iconCls:'icon-remove'" onclick="dodelete()">删除</a>

            <a href="#" class="easyui-linkbutton" iconAlign="right" data-options="iconCls:'icon-add'" onclick="doadd()">添加</a>
             -->
            <a href="#" class="easyui-linkbutton" iconAlign="right" data-options="iconCls:'icon-add'" onclick="window.parent.addTab('tabId_infoCreate','信息新增','<%=root%>/createInfo.do')">添加</a>
            <!-- 
            <a href="#" class="easyui-linkbutton" iconAlign="right" data-options="iconCls:'icon-edit'" onclick="doedit()">修改</a>
             -->
        </form>
    </div>


  </body>
</html>

js

$(function() {
        console.info($("#tt").parent().width() - 2);
        $('#tt').datagrid({
            url : root + "/getInfoList.do",
            title : '信息列表',//文字提示
            iconCls : 'icon-ok',
            fitColumns : true,
            width : $("#tt").parent().width() - 2,//长度
            height : 20,//高度
            pageSize : 10,//默认每页多少行
            pageList : [ 10, 20, 30, 40, 50 ],//可以选择每页多少行
            collapsible:true,
            nowrap : false,
            striped : true,
            collapsible : true,
            loadMsg : '数据装载中......',//等待页面的时候,显示的内容
            toolbar : "#tb",//工具栏               调用ID为tb的div,将工具栏嵌套进去
            frozenColumns : [ [ {
                field : 'ck',
                checkbox : true
            } ] ],
            columns:[[{field:'id',title:'主键',width:30,hidden:true},
                      {field:'title',title:'信息标题',width:30, align:'center'},
                      {field:'operater',title:'发送人',width:30, align:'center'},
                      {field:'opertime',title:'发送时间',width:30, align:'center'}
            ]],
            pagination : true,//启动分页效果
            rownumbers : true, // 显示行数
            singleSelect: true // 只选择一行

        });

});

Controller
/**
     * 查询发送信息列表
     * 
     * @param request
     * @param model
     * @return
     * @throws Exception 
     */
    @RequestMapping(value="/getInfoList.do")
    @ResponseBody
    public Map<String, Object> getInfoList(int page,int rows) throws Exception {

        log.info("查询发送信息开始");

        int start = (page-1)*rows;

        List<Info> users = infoAccessService.getAll(start,rows);

        int total = infoAccessService.getNumber();

        Map<String, Object> map = new HashMap<String, Object>();

        map.put("total", total);
        map.put("rows", users);

        log.info("查询发送信息结束");
        return map;
    }


    以上是我的代码,在返回结果时总是无法加载

  • 写回答

3条回答 默认 最新

  • threenewbee 2015-01-19 03:48
    关注

    下一个断点调试下,看看是数据没有查询到,还是json返回错误还是你的easyui配置问题。

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog