dgrid之Grid集成分页 后台rest service
前台代码 <script type="text/javascript"> define.amd.jQuery = true; require([ "jquery", "dstore/Rest", "dstore/Cache", "dstore/Trackable", "dojo/_base/lang", 'dgrid/extensions/Pagination', "dgrid/Grid", "dojo/dom-construct", "dojo/dom-class", "dojo/on", "dstore/RequestMemory", 'dojo/_base/declare', "dojo/request", "dijit/form/Button", "dojo/io-query", "dojo/parser", "dojo/domReady!" ], function(jquery, Rest, Cache, Trackable, lang, Pagination, Grid, domConstruct, domClass, on, RequestMemory, declare, request, Button, ioQuery){ function createStore(config){ testStore = new declare([ Rest, Cache, Trackable ])(lang.mixin({ target:"listjson.do" }, config)); } createStore(); getColumns2 = function(){ return [ { label: 'No.', field: 'id', formatter: function (value,obj) { return '<span style="color:#0078C1" />'+value+'</span>'; }}, { label: ' Name', field: 'name'}, { label: 'Gender', field: 'gender'}, { label: 'Age', field: 'age'}, { label: 'type', field: 'type' ]; }; var CustomGrid = declare([Grid, Pagination]); var dgrid = new CustomGrid({ className: "dgrid-autoheight", collection: testStore, columns: getColumns2(), pagingLinks: true, pagingTextBox:false, firstLastArrows: false, previousNextArrows: false, showLoadingMessage: true, rowsPerPage: 7 }, "dgrid"); }); </script> <div style="padding:17px 17px; width:1024px;" > <div id="dgrid" ></div> </div> 后台代码 @RequestMapping(method = RequestMethod.GET, value = "listjson") public @ResponseBody HttpEntity listjson(HttpServletRequest request) { Enumeration<String> names=request.getParameterNames(); String limit = null; while(names.hasMoreElements()){ String name = names.nextElement(); if(name.startsWith("limit")){ limit = name; } } String limitNum = limit.substring(6, limit.length()-1); int offset = 0; int pageSize = 0; if(limitNum.contains(",")){ String[] pageinfo = limitNum.split(","); pageSize = Integer.parseInt(pageinfo[0]); offset = Integer.parseInt(pageinfo[1]); }else{ pageSize = Integer.parseInt(limitNum); } int total = count(); int start = offset/pageSize +1; int page = offset/pageSize + 1 ; List list = getList(pageSize, page); HttpHeaders headers = new HttpHeaders(); headers.add( "Content-Range" , "items "+start+"-"+offset+"/"+total); return new HttpEntity<List<User>>(list,headers); }
相关推荐
java Pagination(分页并操作)java Pagination(分页并操作)java Pagination(分页并操作)
jquery.pagination 异步 分页
jquery pagination 分页组件 jquery pagination 分页组件 jquery pagination 分页组件 官网 https://pagination.js.org/index.html 文档 https://pagination.js.org/docs/index.html
jquery pagination 分页 插件 例子和源码
这个是使用jquery.pagination.js实现分页的三种实例,包括使用jquery.pagination.js实现简单的分页,使用ajax实现无刷新分页,还有设置分页属性就行分页。。。
jQuery Pagination,分页插件
jsam-paginationjs分页插件是一款可以动态的在客户端页面渲染出分页条效果,并带有多个配置参数。
第03讲:uni-pagination实现表格分页查询
pagination 分页示例 简洁版 注释 最新
jQueryPager(JQuery分页插件pagination实现Ajax分页) CSDN犀利助互群60168829
jQuery Pagination Ajax 分页插件,本插件实现的分页效果适合移动版和PC版,Ajax在不实现刷新网页的情况下,控制内容分页显示,实现这一功能,需要前台和后台两者结合 ,前台也就是本款代码所展现的功能,实现Ajax的...
bootstrap分页控件pagination在asp.net mvc的使用,采用了bt的日历控件、分页控件、AJAX获取后台分页数据
Java分页 Java分页 Java分页 Java分页
详细参考:http://blog.csdn.net/xiejx618/article/details/47299491 后台的主要任务是获取总记录数和列表数据,剩下的分页功能可以交给前台来做就可以了,感觉jquery pagination...建议详细参考官方文档来了解各个配置...
pagination 前端分页插件
AngularJs-UI, AngularJs Pagination Angularjs分页 -- Want to be the best pagination.
jquery小插件,可以实现数据的分页,里面附带了本人的使用说明和使用案例
一个基于Jquery Pagination插件,从服务器端分页读取数据库信息,并显示的实例,服务器端使用Asp,数据库使用Access。
Jquery 无刷新分页 jquery.pagination.js 带数据库 提交Handler请求数据 AJAX
前端带css样式的分页插件,详情https://blog.csdn.net/qq_36698956/article/details/84305728