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;
}
以上是我的代码,在返回结果时总是无法加载