在java后台,直接取页面上的分页数:
Integer page = Integer.valueOf(request.getParameter("page"));
Integer rows = Integer.valueOf(request.getParameter("rows"));
startrow=(page - 1) * rows;
然后,检索总count数给total:json.put("total", total);
sql检索数据时候只需要加上limit startrow,rows。
jsp(只需要填写url指向后台方法、pagination设为true):
<table id="dg" title="My Users" class="easyui-datagrid" style="width: 700px; height: 250px"
url="${context}/userInfo/findUserInfo.html" toolbar="#toolbar" pagination="true" rownumbers="true"
fitcolumns="true" singleselect="true">
<thead>
<tr>
<th field="userId" width="50">
用户ID
</th>
<th field="userName" width="50">
用户名
</th>
<th field="sex" width="50">
性别
</th>
</tr>
</thead>
</table>
Integer page = Integer.valueOf(request.getParameter("page"));
Integer rows = Integer.valueOf(request.getParameter("rows"));
startrow=(page - 1) * rows;
然后,检索总count数给total:json.put("total", total);
sql检索数据时候只需要加上limit startrow,rows。
jsp(只需要填写url指向后台方法、pagination设为true):
<table id="dg" title="My Users" class="easyui-datagrid" style="width: 700px; height: 250px"
url="${context}/userInfo/findUserInfo.html" toolbar="#toolbar" pagination="true" rownumbers="true"
fitcolumns="true" singleselect="true">
<thead>
<tr>
<th field="userId" width="50">
用户ID
</th>
<th field="userName" width="50">
用户名
</th>
<th field="sex" width="50">
性别
</th>
</tr>
</thead>
</table>
