forked from baukh789/GridManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
baukh789
committed
Dec 4, 2016
1 parent
003a84a
commit 4e917f0
Showing
58 changed files
with
3,107 additions
and
17,758 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[**] | ||
# Unix-style newlines with a newline ending every file | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# 去除行尾空白字符 | ||
trim_trailing_whitespace = true | ||
|
||
# 编码格式,编码格式,支持latin1、utf-8、utf-8-bom、utf-16be和utf-16le,不建议使用uft-8-bom。 | ||
charset = utf-8 | ||
|
||
# 项目中采用tab作为代码缩进样式 | ||
indent_style = tab | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[{package.json,.babelrc,.eslintrc,.esdocrc}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"browser": true, | ||
"browserify": true, | ||
"devel": true, | ||
"globals": { | ||
"jasmine": false, | ||
"describe": false, | ||
"it": false, | ||
"expect": false, | ||
"beforeEach": false, | ||
"afterEach": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
language: node_js | ||
node_js: | ||
- 6 | ||
cache: | ||
directories: | ||
- node_modules | ||
before_install: | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
script: | ||
- npm test | ||
- npm run report-coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,276 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | ||
<link rel="stylesheet" type="text/css" href="../src/css/base.css"> | ||
<link rel="stylesheet" type="text/css" href="../src/css/GridManager.css"> | ||
<title>GridManager:使用动态数据渲染</title> | ||
<style> | ||
html, body{ | ||
overflow-x:hidden; | ||
} | ||
h2{ | ||
font-size:22px; | ||
padding:10px 30px; | ||
color:#333; | ||
} | ||
p{ | ||
font-size:14px; | ||
padding:10px 30px; | ||
color:#333; | ||
text-indent:2em; | ||
} | ||
hr{ | ||
margin-top: 18px; | ||
margin-bottom: 18px; | ||
border: 0; | ||
border-top: 1px solid #eee; | ||
} | ||
.plugin-action{ | ||
display: inline-block; | ||
color: steelblue; | ||
margin-right: 10px; | ||
cursor: pointer; | ||
} | ||
.plugin-action:hover{ | ||
text-decoration:underline; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<h2>GridManager:使用动态数据渲染</h2> | ||
<p>注意:</p> | ||
<p>1.存在.json文件,谷歌需要放到环境中效果才能展现.</p> | ||
<p>2.数据采用的是.json的模拟请求数据,所以在切换分页时数据看上去并未变化.</p> | ||
<p>3.当前使用的排序方式为组合排序</p> | ||
<p>4.此Demo存在跨域请求,只做为演示不可直接使用</p> | ||
<button id="create-gm">渲染GridManager</button> | ||
<hr/> | ||
<div style="width:95%;margin:0px auto;"> | ||
<table grid-manager="cccc"></table> | ||
</div> | ||
<script type="text/javascript" src="../node_modules/jTool/jTool.js"></script> | ||
<script type="text/javascript"> | ||
var $ = jTool; | ||
</script> | ||
<script type="text/javascript" src="../build/GridManager.js"></script> | ||
<script type="text/javascript"> | ||
document.getElementById('create-gm').onclick = function(){ | ||
|
||
//单列表简易渲染 | ||
var table = document.querySelector('table[grid-manager]'); | ||
/* | ||
$.fn.GM.defaults = { | ||
isDevelopMode: true, | ||
autoLoadCss:true //自动加载CSS文件,无需在页面中引用 | ||
}; | ||
*/ | ||
table.GM({ | ||
supportRemind: true | ||
,isDevelopMode: true | ||
,autoLoadCss:true //自动加载CSS文件,无需在页面中引用 | ||
,i18n:'zh-cn' | ||
,textConfig:{ | ||
'page-go': { | ||
'zh-cn':'跳转', | ||
'en-us':'Go ' | ||
} | ||
} | ||
,supportSetTop: true | ||
,gridManagerName:'aaa' | ||
,disableCache:true | ||
,disableOrder:false | ||
,supportSorting: true | ||
,supportDrag:true | ||
,supportAjaxPage:true | ||
,emptyTemplate: '<div class="gm-emptyTemplate">什么也没有</div>' | ||
,ajax_data : { | ||
"data":[{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
}, | ||
{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
}, | ||
{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
}, | ||
{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
}, | ||
{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
},{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
}, | ||
{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
}, | ||
{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
}, | ||
{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
}, | ||
{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
},{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
}, | ||
{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
}, | ||
{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
}, | ||
{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
}, | ||
{ | ||
"name": "baukh", | ||
"age": "28", | ||
"createDate": "2015-03-12", | ||
"info": "野生前端程序", | ||
"operation": "修改" | ||
} | ||
], | ||
"totals": 1682 | ||
} | ||
,isCombSorting: false | ||
,pageSize:30 | ||
,query: {ex: '用户自定义的查询参数,格式:{key:value}'} | ||
,columnData: [{ | ||
key: 'name', | ||
remind: 'the username', | ||
sorting: 'up', | ||
width: '200px', | ||
text: 'username' | ||
},{ | ||
key: 'age', | ||
remind: 'the age', | ||
sorting: '', | ||
width: '200px', | ||
text: 'age' | ||
},{ | ||
key: 'createDate', | ||
remind: 'the createDate', | ||
sorting: 'down', | ||
width: '200px', | ||
text: 'createDate' | ||
},{ | ||
key: 'info', | ||
remind: 'the info', | ||
sorting: '', | ||
text: 'info' | ||
},{ | ||
key: 'operation', | ||
remind: 'the operation', | ||
sorting: '', | ||
width: '100px', | ||
text: 'operation', | ||
template: function(operation, rowObject){ //operation:当前key所对应的单条数据;rowObject:单个一行完整数据 | ||
return '<a href=javascript:alert("这是一个按纽");>'+operation+'</a>'; | ||
} | ||
} | ||
] | ||
,pagingBefore:function(query){ | ||
console.log('Event: 分页前', query); | ||
} | ||
,pagingAfter: function(query){ | ||
console.log('Event: 分页后', query); | ||
} | ||
,sortingBefore:function(query){ | ||
console.log('Event: 排序前', query); | ||
} | ||
,sortingAfter: function(query){ | ||
console.log('Event: 排序后', query); | ||
} | ||
,ajax_success: function(data){ | ||
console.log('Event: ajax_success', data); | ||
} | ||
}); | ||
|
||
// 日期格式化,不是插件的代码,只用于处理时间格式化 | ||
Date.prototype.format = function(fmt){ | ||
var o = { | ||
"M+": this.getMonth() + 1, //月份 | ||
"D+": this.getDate(), //日 | ||
"d+": this.getDate(), //日 | ||
"H+": this.getHours(), //小时 | ||
"h+": this.getHours(), //小时 | ||
"m+": this.getMinutes(), //分 | ||
"s+": this.getSeconds(), //秒 | ||
"q+": Math.floor((this.getMonth() + 3) / 3), //季度 | ||
"S": this.getMilliseconds() //毫秒 | ||
}; | ||
if (/([Y,y]+)/.test(fmt)){ | ||
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); | ||
} | ||
for (var k in o){ | ||
if(new RegExp("(" + k + ")").test(fmt)){ | ||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); | ||
} | ||
} | ||
return fmt; | ||
} | ||
} | ||
</script> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.