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 ...
随机推荐
- win32 API 学习
SendMessage 函数原型 LRESULT SendMessage(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM IParam) 详情:百度百科 msd ...
- Android 一步一步教你使用ViewDragHelper
在自定义viewgroup的时候 要重写onInterceptTouchEvent和onTouchEvent 这2个方法 是非常麻烦的事情,好在谷歌后来 推出了ViewDragHelper这个类.可以 ...
- 一种Javascript解释ajax返回的json的好方法
通常ajax请求返回的格式为json或者xml,如果返回的是json,则可以通过转换成javascript对象进行操作,如下: 1.ajax请求的controller实现 @RequestMappin ...
- Math.random();函数 随机数
random函数参数 无参数 random函数返回值 返回0和1之间的伪随机数,可能为0,但总是小于1,[0,1) random函数示例 document.write(Math.random()); ...
- ulimit 命令
用途:ulimit用于shell启动进程所占用的资源. 类别:shell内建命令 语法格式:ulimit [-acdfHlmnpsStvw] [size] 参数: -H 设置硬资源限制. -S 设置软 ...
- hdu 1969(二分)
题意:给了你n个蛋糕,然后分给m+1个人,问每个人所能得到的最大体积的蛋糕,每个人的蛋糕必须是属于同一块蛋糕的! 分析:浮点型二分,二分最后的结果即可,这里要注意圆周率的精度问题! #include& ...
- Linux环境Weblogic10g服务部署
1.先安装XManager: 2.进入XShell,远程连接Linux主机后,按如下操作即可打开XManager配置WebLogic部署服务: [root@server36 bin]# cd /[ro ...
- iOS学习笔记之ARC内存管理
iOS学习笔记之ARC内存管理 写在前面 ARC(Automatic Reference Counting),自动引用计数,是iOS中采用的一种内存管理方式. 指针变量与对象所有权 指针变量暗含了对其 ...
- 【LeetCode】111 - Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shor ...
- 数往知来 CSS<十二>
div+css基础 一.外部样式<!--外部样式可以使网页与样式分离,分工处理 1.写网页,主要提供内容,一般都会有固定的结构,具有id等属性的标签包括特定的内容 2.根据结构写样式另存为css ...