blob: dcbcbff14f843d45e0de1e5a0978f05fdd9982d1 (
plain)
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
|
<!DOCTYPE html>
<html>
<!--
Copyright 2010 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<title>goog.ui.TableSorter</title>
<script src="../base.js"></script>
<script>
goog.require('goog.ui.TableSorter');
</script>
<link rel="stylesheet" href="css/demo.css">
<link rel="stylesheet" href="../css/tablesorter.css">
<style>
/** Each application can choose how to show sorted state.
This is a simple way, just toggling background colors. */
th.goog-tablesorter-sorted {
background-color: #eef;
}
th.goog-tablesorter-sorted-reverse {
background-color: #fee;
}
</style>
</head>
<body>
<h1>goog.ui.TableSorter</h1>
<p>
Number sorts numerically, month sorts alphabetically, and days sorts
numerically in reverse.
</p>
<table border="0" cellpadding="3" id="sortMe">
<thead>
<tr>
<th>Number</th>
<th>Month</th>
<th>Days (non-leap year)</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>January</td>
<td>31</td>
</tr>
<tr>
<td>2</td>
<td>Februrary</td>
<td>28</td>
</tr>
<tr>
<td>3</td>
<td>March</td>
<td>31</td>
</tr>
<tr>
<td>4</td>
<td>April</td>
<td>30</td>
</tr>
<tr>
<td>5</td>
<td>May</td>
<td>31</td>
</tr>
<tr>
<td>6</td>
<td>June</td>
<td>30</td>
</tr>
<tr>
<td>7</td>
<td>July</td>
<td>31</td>
</tr>
<tr>
<td>8</td>
<td>August</td>
<td>31</td>
</tr>
<tr>
<td>9</td>
<td>September</td>
<td>30</td>
</tr>
<tr>
<td>10</td>
<td>October</td>
<td>31</td>
</tr>
<tr>
<td>11</td>
<td>November</td>
<td>30</td>
</tr>
<tr>
<td>12</td>
<td>December</td>
<td>31</td>
</tr>
</tbody>
</table>
<br/>
<script>
var component = new goog.ui.TableSorter();
component.decorate(goog.dom.getElement('sortMe'));
component.setSortFunction(1, goog.ui.TableSorter.alphaSort);
component.setSortFunction(2,
goog.ui.TableSorter.createReverseSort(goog.ui.TableSorter.numericSort));
</script>
</body>
</html>
|