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 ...
随机推荐
- hive部署手册
安装环境: 机器 只需要安装一台机器 操作系统:Ubuntu 11.04 64操作系统 hadoop:版本是1.0.2,安装在/usr/local/hadoop sun ...
- Android 高仿豌豆荚 一键安装app 功能 实现
以往我们那些应用市场 帮我们安装app的时候 我们都得点确定,当然你如果 root 以后 不用点确定 也能自动安装了,后来豌豆荚 推出了一个功能 非root的手机也能不点确定 直接帮你安装好.(如果 ...
- 树莓派 安装 php
执行如下命令(注意红色字部分是关键!) sudo apt-get install apache2 php5 libapache2-mod-php5 然后把网页文件复制到 /usr/www 中即可 参考 ...
- C# 对Excel文档打印时的页面设置
1.对打印页面的朝向,页宽,页高进行设置 参考源码[1] using Excel = Microsoft.Office.Interop.Excel; Excel.Application tmpExce ...
- Go 语言做的几个验证码
1.http://www.oschina.net/code/snippet_173630_12006 : 效果: 源代码: 1: package main 2: 3: import ( 4: cra ...
- C#读写文件总结
1.使用FileStream读写文件 文件头: using System; using System.Collections.Generic; using System.Text; using ...
- [转]Loadrunner11之VuGen运行时设置Run-Time Setting
转自:http://www.51testing.com/html/92/450992-248065.html General 1.Run Logic运行逻辑 脚本如何运行的,每个action和acti ...
- (转载)OC学习篇之---Foundation框架中的NSString对象和NSMutableString对象
在之前的一篇文章中我们说到了Foundation框架中的NSObject对象,那么今天在在来继续看一下Foundation框架中的常用对象:NSString和NSMutableString. 在OC中 ...
- Android中使用logwrapper来重定向应用程序的标准输出
在Android应用程序调试中,有时候第三方应用程序的日志输出是通过printf之类的标准函数输出的,logcat不能捕获这些日志,一个方法是使用logwrapper命令来执行第三方应用程序,logw ...
- Docker进入主流,PaaS大有可为(转)
add by zhj: 文章简单的说了PaaS所使用的传统容器的缺点,而docker这个容器在一定程度上解决了这些问题,越来越多的PaaS平台使用docker作容器,实现应用的隔离.不过,由于dock ...