页面加载初始化 就去访问数据库查询出4行记录,但只显示第一行
jsp代码:
$(function(){
$("#emp_datagrid").datagrid({
fit:true,
url:'${APP_PATH}/employee_list',
fitColumns:true,
rownumbers:true,
pagination:true,
toolbar:'#emp_datagrid_tb',
pageList:[2,4,10],
columns:[
[
{field:'username',algin:'center',title:'用户名',width:1},
{field:'realname',algin:'center',title:'真实名称',width:1},
{field:'tel',algin:'center',title:'电话',width:1},
{field:'email',algin:'center',title:'邮箱',width:1},
{field:'dept',algin:'center',title:'部门',width:1,formatter:deptFormatter},
{field:'inputtime',algin:'center',title:'入职时间',width:1},
{field:'state',algin:'center',title:'状态',width:1},
{field:'admin',algin:'center',title:'是否为超级管理员',width:1},
]
]
});
});
function deptFormatter(value,record,index){
return value?value.name:"";
}
控制台打印的sql语句
DEBUG [http-nio-8080-exec-24] - ooo Using Connection [com.mysql.cj.jdbc.ConnectionImpl@69957f7]
DEBUG [http-nio-8080-exec-24] - ==> Preparing: select count(*) from employee
DEBUG [http-nio-8080-exec-24] - ==> Parameters:
TRACE [http-nio-8080-exec-24] - <== Columns: count(*)
TRACE [http-nio-8080-exec-24] - <== Row: 4
DEBUG [http-nio-8080-exec-24] - <== Total: 1
DEBUG [http-nio-8080-exec-24] - ooo Using Connection [com.mysql.cj.jdbc.ConnectionImpl@69957f7]
DEBUG [http-nio-8080-exec-24] - ==> Preparing: select e.username, e.realname, e.tel, e.email, e.dept_id, e.inputtime, e.state, e.admin, d.id as d_id,d.name as d_name from employee e left join department d on (d.id=e.dept_id) limit ?,?
DEBUG [http-nio-8080-exec-24] - ==> Parameters: 0(Integer), 2(Integer)
TRACE [http-nio-8080-exec-24] - <== Columns: username, realname, tel, email, dept_id, inputtime, state, admin, d_id, d_name
TRACE [http-nio-8080-exec-24] - <== Row: admin, bravo1988, 18257534567, 523839773@qq.com, 1, 2019-08-15, 1, 1, 1, 总经办
TRACE [http-nio-8080-exec-24] - <== Row: test, 啊啊啊, 18257555345, 527384765@qq.com, 2, 2019-08-13, 1, 0, 2, 市场部
DEBUG [http-nio-8080-exec-24] - <== Total: 2
页面:
当我切换第二页时候:
数据库表:
在线等各路大佬指点问题出在哪里,我感觉是因为easyui的分页属性设置的问题,可是找半天也没找到