-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathnews-datalist.html
144 lines (135 loc) · 5.4 KB
/
news-datalist.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>演示-ajax内容列表</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="css/jeui.css" media="all">
<script type="text/javascript" src="js/modules/jeui.js"></script>
<script type="text/javascript" src="js/userdata.js"></script>
</head>
<body>
<div class="je-p20">
<blockquote class="je-quote je-f16">
Ajax动态数据
</blockquote>
<div id="testtwo" class="je-f14"></div>
<blockquote class="je-quote je-f16 je-mt20">
静态数据
</blockquote>
<div id="testtable" class="je-f14"></div>
</div>
<script type="text/javascript">
jeui.use(["jquery","jeTable","jeCheck"],function () {
$("#testtable").jeTable({
//width:600,
height:"400",
isPage:false,
datas:user.data,
columnSort:[2,3,4],
columns:[
{
name:['ID',function () {
return '<input type="checkbox" name="checkbox" id="gocheck" jename="chunk">'
}],
field:'id', width:"80", align: 'center',
renderer:function (obj,rowidx) {
return '<input type="checkbox" name="checkbox" id="'+obj.id+'" jename="chunk">'
}
},
{name:'姓名', field:'userName', width:"120", align: 'left'},
{ name:'性别', field:'userSex' ,width:"100", align:'center'},
{ name:'邮箱', field:'email' ,width:"300", align:'left' },
{ name:'手机', field:'phone' ,width:"150", align:'center'},
{ name:'身份证号', field:'identity' ,width:"200", align:'left', renderer: ""},
{ name:'地址', field:'address' ,width:"250", align:'left', renderer: ""},
{ name:'时间', field:'joinTime' ,width:"200", align:'left', renderer: function(obj,rowidx){
return formatdate(obj.joinTime,"YYYY-MM-DD hh:mm:ss")
}},
{ name:'详情', field:'id' ,width:"100", align:'center',renderer: function(obj,rowidx){
//console.log(obj)
return "<a href='javascript:;' class='je-blue' onclick=objtest('"+obj.userName+"')>查看"+rowidx+"</a>";
}}
],
itemfun:function (elem,data) {
elem.on("dblclick",function () {
console.log(elem.find("input[type=checkbox]").prop("checked"))
//var trdata = $.parseJSON($(this).attr("trdata"));
})
},
success:function (elCell,tbody) {
elCell.jeCheck({
jename:"chunk",
checkCls:"je-check",
itemfun: function(elem,bool) {
//alert(elem.attr("jename"))
},
success:function(elem){
jeui.chunkSelect(elem,"#gocheck",'on')
}
});
}
})
$("#testtwo").jeTable({
//width:"100%",
height:300,
datas:{
url:"http://cm.jtccs.com/testitem.php",
//url:"http://sinarts.byethost17.com/testitem.php",
data:{totalcount:"600"},
type:"POST",
async:false,
dataType:"jsonp",
field:"rows"
},
pageField:{
pageIndex:{field:"size",num:1},
pageSize:{field:"pagesize",num:15},
ellipsis:true,
dataCount:"totalCount",
pageCount:"totalPage"
},
columnSort:[],
columns:[
{name:'ID', field:'id', width:"80", align: 'center',isShow:false, renderer: ""},
{ name:'名称', field:'name' ,width:"550", align:'left' },
{name:'随机字符',field:'randStr',width:"150", align:'left'},
{ name:'随机数字', field:'time' ,width:"200", align:'left', renderer: ""}
],
itemfun:function (elem,data) {
elem.on("dblclick",function () {
//var trdata = $.parseJSON($(this).attr("trdata"));
})
}
})
});
function objtest(obj){
alert(obj);
}
function formatdate(str,attr) {
if (isNaN(str)){
return str;
}else {
var fmt = attr || "YYYY-MM-DD", dateNum = parseInt((str.toString()).substring(0,10)),
times = new Date(dateNum * 1000);
var o = {
"M+": times.getMonth() + 1, // 月
"D+": times.getDate(), // 日
"h+": times.getHours(), // 时
"m+": times.getMinutes(), // 分
"s+": times.getSeconds(), // 秒
"q+": Math.floor((times.getMonth() + 3) / 3), // 季度
"ms": times.getMilliseconds() // 毫秒
};
if (/(Y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (times.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>