datagrid如何使用自定义参数实现后台分页,springmvc 在使用easyui的datagrid时后台分页参数需要传入
分页对象里,下面说一下datagrid后台分页参数自定义设置
需要在onBeforeLoad方法中修改分页参数的值 如下
$('#userTable').datagrid({
url:admin_user_list_url,
onBeforeLoad:function(param){
param["pageable.currentPage"] = param.page;
param["pageable.pageSize"] = param.rows;
param["pageable.order"] = param.order;
param["pageable.sortField"] = param.sort;
},
frozenColumns:[[
{field:'ck',checkbox:true}
]],
columns:[[
{field:'id',title:'id',hidden:true},
{field:'userName',title:'登录名',width:100,sortable:true},
{field:'realName',title:'真实姓名',width:100},
{field:'email',title:'邮箱',width:100},
{field:'phone',title:'手机',width:100},
{field:'qq',title:'QQ',width:100},
{field:'role.name',title:'角色',width:100,formatter:user.roleNameFormatter}
]],
pagination:true
});
其中pageable是后台的分页对象里面有
pageable.currentPage是当前第几页,对应datagrid参数是param.page
pageable.pageSize一页有多少行,对应datagrid参数是param.rows
pageable.order 排序升序还是降序,对应datagrid参数是param.order
pageable.sortField排序字段,对应datagrid参数是param.sort