-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrowSort_basic.html
164 lines (156 loc) · 4.87 KB
/
rowSort_basic.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta charset="UTF-8" />
<title>jquery.rowsorter.js</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
<body>
<style>
/*unSecable*/
.unSecable{-o-user-select: none;-webkit-user-select: none;-moz-user-select: -moz-none;-khtml-user-select: none;-ms-user-select: none;user-select: none;}
div.work {
float: left;
width: 420px;
height: 400px;
margin: 20px 0 0 20px;
overflow: auto;
}
pre {
float: left;
margin-top: 20px;
padding: 8px;
width: 490px;
height: 400px;
overflow: auto;
background: #eee;
font-family: consolas, "courier new";
font-size: 14px;
}
#log {
display: inline-block;
margin-top: 20px;
padding: 5px;
width: 390px;
background: #eee;
}
table {width: 400px; font-size: 14px; font-family: tahoma, arial, sans-serif;}
table thead th {background-color: #ccc; padding: 5px 8px;}
table td {background-color: #ddd; padding: 5px 8px;}
table.sorting-table {cursor: move;}
table tr.sorting-row td {background-color: #8b8;}
.hand2{display:inline-block;width:20px;height:20px;vertical-align:middle;background:#ccc}
</style>
<div class="work">
<table>
<thead>
<tr>
<th colspan="3">Basic Sorting</th>
</tr>
</thead>
<tbody id="table1">
<tr>
<td>Row 1</td>
<td>Sample Content 1</td>
<td>Sample Content 1</td>
</tr>
<tr>
<td>Row 2</td>
<td>Sample Content 2</td>
<td>Sample Content 2</td>
</tr>
<tr>
<td>Row 3</td>
<td>Sample Content 3</td>
<td>Sample Content 3</td>
</tr>
<tr>
<td>Row 4</td>
<td>Sample Content 4</td>
<td>Sample Content 4</td>
</tr>
<tr>
<td>Row 5</td>
<td>Sample Content 5</td>
<td>Sample Content 5</td>
</tr>
</tbody>
</table>
<code id="log"></code>
<div id="sort2">
<div class="sortRow"><em class="hand2"></em>111111</div>
<div class="sortRow"><em class="hand2"></em>222222</div>
<div class="sortRow"><em class="hand2"></em>333333</div>
<div class="sortRow"><em class="hand2"></em>444444</div>
<div class="sortRow"><em class="hand2"></em>555555</div>
</div>
<a href="javascript:;" id="diamgic">Add Row</a>
</div>
<pre>
<table id="table1">
<thead>
<tr>
<th colspan="3">Basic Sorting</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row 1</td>
<td>Sample Content 1</td>
<td>Sample Content 1</td>
</tr>
<tr>
<td>Row 2</td>
<td>Sample Content 2</td>
<td>Sample Content 2</td>
</tr>
<tr>
<td>Row 3</td>
<td>Sample Content 3</td>
<td>Sample Content 3</td>
</tr>
<tr>
<td>Row 4</td>
<td>Sample Content 4</td>
<td>Sample Content 4</td>
</tr>
<tr>
<td>Row 5</td>
<td>Sample Content 5</td>
<td>Sample Content 5</td>
</tr>
</tbody>
</table>
<script type="text/javascript">
$("#table1").rowSorter({
onDrop: function(tbody, row, new_index, old_index) {
$("#log").html(old_index + ". row moved to " + new_index);
}
});
</script>
</pre>
<script type="text/javascript" src="js/jquery1.91.min.js"></script>
<script type="text/javascript" src="js/asdui.js"></script>
<script>
//ZUI.Rowsort
var sort1= new ZUI.Rowsort('table1',{
onDrop: function(tbody, row, new_index, old_index) {
$("#log").html(old_index + ". row moved to " + new_index);
}
});
var sort2= new ZUI.Rowsort('sort2',{
handler: ".hand2",
sortElemts:'.sortRow',
onDrop: function(tbody, row, new_index, old_index) {
$("#log").html(old_index + ". row moved to " + new_index);
}
});
$(function(){
var i=0;
$('#diamgic').on('click',function(){
i++;
$('#sort2').append('<div class="sortRow"><em class="hand2"></em>'+i+'</div>')
});
});
</script>
</body>
</html>