dojo grid 分页
dojo很强大,也很方便,但是缺少文档,只能看源代码,也挺好的,就是费时间。。。
网上找了一段代码(找不到原出处了,不好意思),也看了dojo自带的demo,放一段可以执行的页面代码这里。把ip换成自己架设的js服务器(esi的CDN貌似有点问题)即可
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>dojo grid 分页</title> <link rel="stylesheet" href="http://192.168.30.86/arcgis_js_api/library/3.12/dojo/resources/dojo.css">
<link rel="stylesheet" href="http://192.168.30.86/arcgis_js_api/library/3.12/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://192.168.30.86/arcgis_js_api/library/3.12/dijit/themes/claro/document.css">
<link rel="stylesheet" href="http://192.168.30.86/arcgis_js_api/library/3.12/dojox/grid/enhanced/resources/claro/EnhancedGrid.css">
<link rel="stylesheet" href="http://192.168.30.86/arcgis_js_api/library/3.12/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css"> <style>
#gridDiv{
width: 60em;
height: 35em;
border: 1px solid #D5CDB5;
}
</style>
<script src="http://192.168.30.86/arcgis_js_api/library/3.12/init.js"></script>
<script> require([
"dojo/parser",
"dojox/grid/EnhancedGrid", //表格
"dojo/data/ItemFileWriteStore",//数据
"dojox/grid/enhanced/plugins/DnD", //拖拽
"dojox/grid/enhanced/plugins/Pagination",//分页
"dojox/grid/enhanced/plugins/nestedSorting",//嵌套排序
"dijit/form/Button","dojo/dom","dojo/on","esri/config","esri/lang","dojo/domReady!"
],
function () {
//获取数据
var data = {
identifier : 'id',
items : []
};
var data_list = [{
col1 : "normal",
col2 : false,
col3 : 'But are not followed by two hexadecimal',
col4 : 29.91
}, {
col1 : "important",
col2 : false,
col3 : 'Because a % sign always indicates',
col4 : 9.33
}, {
col1 : "important",
col2 : false,
col3 : 'Signs can be selectively',
col4 : 19.34
}
];
var rows = 60;
for (var i = 0, l = data_list.length; i < rows; i++) {
data.items.push(dojo.mixin({
id : i + 1
}, data_list[i % l]));
}
var store = new dojo.data.ItemFileWriteStore({
data : data
}); dojo.ready(function () {
/*set up layout*/
var layout = [[{
name : 'slector',
field : 'Sel',
editable : true,
width : '20px',
cellStyles : 'text-decoration: none; cursor:default; text-align: center;position: relative; left: -10px',
headerStyles : 'text-align: center;',
type : dojox.grid.cells.Bool//选择器
}, {
'name' : 'Column 1',
'field' : 'id'
}, {
'name' : 'Column 2',
'field' : 'col2'
}, {
'name' : 'Column 3',
'field' : 'col3',
'width' : '230px'
}, {
'name' : 'Column 4',
'field' : 'col4',
'width' : '230px'
}
]];
/*create a new grid:*/
var grid = new dojox.grid.EnhancedGrid({
id : 'grid',
store : store,
structure : layout,
plugins : {
nestedSorting:true,//嵌套排序
dnd : false,//数据拖拽
pagination : {//分页
pageSizes :[ "10", "20", "50","100", "ALL"],//最后一个只是标识,不显示的
//[10, 20, 50, Infinity],//或者换这种写法
//description: true,//描述,第1-20个,共60个。默认是true
//sizeSwitch: true,//分页大小切换,默认是true
maxPageStep : 8,
gotoButton : true,//转至第几页,默认为false
defaultPage : 1,
defaultPageSize : 20,
position: "bottom"//有三种方式,top, bottom, both,默认是bottom
},
},
rowSelector : '20px'
},
document.createElement('div'));
/*append the new grid to the div*/
dojo.byId("gridDiv").appendChild(grid.domNode);
/*Call startup() to render the grid*/
grid.startup();
}); });
</script>
</head>
<body class="claro">
<div id="gridDiv">
</div>
</body>
</html>
gird分页
效果如下图

其他的再说吧
dojo grid 分页的更多相关文章
- dojo grid 编辑问题
今天dojo grid编辑小问题,找了半天才找到问题, 1.问题 2.原因 数据单元没有索引列->id 3.修改前代码 <!DOCTYPE HTML> <html lang=& ...
- dojo表格分页插件报错
dojo表格分页插件报错 (1)dojo/parser::parse() error ReferenceError {stack:(...),message:"layout is not d ...
- dojo表格分页之各个参数代表的意义(一)
下面是dojo表格分页参数代表的意义 //每页可以显示10/15/20/25/30条记录 (1)pageSizes: [10, 15, 20, 25,30], //每页显示的记录从多少到多少,共多少条 ...
- [转]ExtJS Grid 分页时保持选中的简单实现方法
原文地址 :http://www.qeefee.com/article/ext-grid-keep-paging-selection ExtJS中经常要用到分页和选择,但是当选择遇到分页的时候,杯具就 ...
- ExtJS自制表格Grid分页条
试过Grid自带的load和分页功能,没有成功,干脆就自己写了...... 主要是查询条件比较复杂...... 希望哪位大神能有更好的意见. Ext.define('MyApp.ux.Paginati ...
- ExtJS入门教程06,grid分页的实现
前面两篇内容分别介绍了extjs grid的基本用法和extjs grid异步加载数据,这篇文章将介绍extjs grid的分页. 数据量大的时候我们必须用到分页,结合上一篇的异步加载数据,今天我们就 ...
- ExtJs4 SpringMvc3 实现Grid 分页
新建一个Maven webapp项目,webxml以及spring配置没什么需要注意的,不再赘述. Maven依赖:(个人习惯,有用没用的都加上...) <project xmlns=" ...
- extjs grid 分页
在使用extjs创建带分页功能的 grid 如下: 1.创建一个模型 // 创建算定义模型 模型名称 User Ext.define('User', { extend: 'Ext.data.Model ...
- Ext4.1 Grid 分页查询
转载:http://blog.csdn.net/zyujie/article/details/16362747 最近用Ext4.1自己做了做项目的练习:把一些知识点,在这里记录下来了! 上面一个for ...
随机推荐
- 【英语】Bingo口语笔记(22) - Talk系列
talk back 顶嘴 talk somebody in to something 劝某人做某事 tal somebody out of something 劝某人不做某事
- node前端自动化
一.前端自动化-项目构建 我们平时写代码,喜欢建一个project,然后里面是css.js.images文件,以及index.html,而node可以自动化构建好项目,如下: /** * Create ...
- 查看MySQL的警告信息
在王MySQL数据库导入数据的时候经常会出现警告,这些警告很容易被忽视,今天到数据的时候突然想看看警告的内容是什么,百度了一下mysql查看警告的命令 show warnings; 命令很简明,一查看 ...
- php下的jsonp使用实例
参考资料:http://www.cnblogs.com/chopper/archive/2012/03/24/2403945.html 测试依赖条件: 项目eetopinOfficial 在hosts ...
- org-mode
org-mode 编辑 目录 1简介 2扩展 1简介编辑 Org-模式(Org-mode)是文本编辑软件Emacs的一种支持内容分级显示的编辑模式.这种模式支持写 to-do 列表,日志管 ...
- Android应用开发学习—Toast使用方法大全
Toast 是一个 View 视图,快速的为用户显示少量的信息. Toast 在应用程序上浮动显示信息给用户,它永远不会获得焦点,不影响用户的输入等操作,主要用于 一些帮助 / 提示. Toast 最 ...
- EhCache 分布式缓存/缓存集群
开发环境: System:Windows JavaEE Server:tomcat5.0.2.8.tomcat6 JavaSDK: jdk6+ IDE:eclipse.MyEclipse 6.6 开发 ...
- 自己使用python webob,paste.deploy,wsgi总结
paste.deploy就是一个可以配置wsgi_app的工具,可以让服务器运行时,按照配置文件执行一系列的程序.需要使用.ini配置文件. (1)这里补充一下当时没看到的配置文件 1.[app:ma ...
- <System.ServiceModel>
實例: <system.serviceModel> <diagnostics performanceCounters="All" /> < ...
- LeetCode(9) - Palindrome Number
题目要求判断一个整数是不是回文数,假设输入是1234321,就返回true,输入的是123421,就返回false.题目要求in-place,思路其实很简单,在LeetCode(7)里面我们刚好做了r ...