forked from cgwxyz/VDataTable
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·196 lines (195 loc) · 4.01 KB
/
Copy pathindex.html
File metadata and controls
executable file
·196 lines (195 loc) · 4.01 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>VDataTable Demo</title>
<style type="text/css">
form p { min-height: 20px;}
#shower{
width:600px;
}
ul#vtable_title{padding:0;
margin:0;
width:100%;
height:25px;
line-height:25px;
list-style-type:none;
border:0px;
}
ul#vtable_title li{
display:inline;
float:left;
border:0px;
border-bottom:1px solid #CCC;
}
ul#vtable_data{
padding:0;
margin:0;
width:100%;
line-height:25px;
list-style-type:none;
border:0px;
}
ul#vtable_data li{
width:100%;
display:inline;
float:left;
border:0px;
border-bottom:1px solid #CCC;
}
.vdata_pagebar_li {
text-align:right;
font-size:12px;
color:#333;
border:0px;
}
.vdata_pagebar_li a{
font-size:12px;
color:#006699;
text-decoration:none;
cursor:pointer;
}
.vdata_select_li a{
font-size:12px;
color:#006699;
text-decoration:none;
cursor:pointer;
padding:0px;
padding-left:2px;
padding-right:2px;
}
#op_bar{
width:100%;
height:25px;
line-height:25px;
text-align:left;
font-size:12px;
color:#333;
/*border:1px solid #CCC;*/
background-color:#FFF;
}
#op_bar a{
color:#0099CC;
padding-left:2px;
padding-right:2px;
}
.spec{
background-color:#F1D574;
}
.curr{
background-color:#FF0000;
}
.yselected{
background-color:#0099FF;
}
.getchecked{
background-color:#0099CC;
}
#debugbox{
width:100%;
height:200px;
line-height:20px;
border:1px solid #CCC;
clear:both;
}
</style>
</head>
<body>
<h2>Table</h2>
<div id="shower">
</div>
<script src="./jquery-1.10.1.min.js" type="text/javascript" language="javascript" charset="utf-8"></script>
<script src="./jquery.vdatatable.js" type="text/javascript" language="javascript" charset="utf-8"></script>
<script type="text/javascript" language="javascript" charset="utf-8">
var mytable = 0;
$(document).ready(function(){
mytable = $('#shower').VDataTable({
source:'data.php',
request_way:'get',//ajax request type get/post
request_param:{},
m_title_obj:'vtable_title',
m_data_obj:'vtable_data',
m_ctrl_obj:'vtable_ctrl',
uniqueID:'webinar_id',
target:'#shower',
pagelimit:15,
pageCallback:'showUserList',
op:[
{
'content':'编辑',
'desc':'编辑此记录',
'callback':'func1'
},{
'content':'删除',
'desc':'删除此记录',
'callback':'func2'
}
],
TitleBar:{//Title & data defintion
'id':{
'title':'ID', //ID=>id
'w':'10%',
'align':'left',
'display':false,
'data-align':'center'//default left
},
'name':{
'title':'Name',//with default view
'w':'40%',
'align':'left',
'data-align':'left'
},
'email':{
'title':'Email',
'w':'50%',
'align':'left',
'data-align':'left'
}
},
lang:{
nodata:'No data founded',
choose_op:'Choose operation:',
first:'First',
next:'Next',
prev:'Previous',
total:'Total:',
page:'page',
showing:'showing',
last:'Last',
all:'All',
revert:'Revert',
cancel:'Cancel'
}
});
});
function func1(){
//alert('func1:'+mytable.getKeyValue());
doAddData();
}
function func2(data){
if(!confirm("确定删除此记录")){
return false;
}
var key = mytable.getKeyValue();
if(key === false){
alert("未指定操作记录");
return false;
}
mytable.removeItem(key);
}
function showUserList(page){
alert("get page:"+page);
}
function doAddData(){
var obj = {
'id':7123128,
'name':'naasd1',
'email':'[email protected]'
};
mytable.addItem(obj);
}
</script>
<div id="debugbox"></div>
</body>
</html>