jquery-tablesorter 0.0.5 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,184 +0,0 @@
1
- (function($) {
2
- $.extend({
3
- tablesorterPager: new function() {
4
-
5
- function updatePageDisplay(c) {
6
- var s = $(c.cssPageDisplay,c.container).val((c.page+1) + c.seperator + c.totalPages);
7
- }
8
-
9
- function setPageSize(table,size) {
10
- var c = table.config;
11
- c.size = size;
12
- c.totalPages = Math.ceil(c.totalRows / c.size);
13
- c.pagerPositionSet = false;
14
- moveToPage(table);
15
- fixPosition(table);
16
- }
17
-
18
- function fixPosition(table) {
19
- var c = table.config;
20
- if(!c.pagerPositionSet && c.positionFixed) {
21
- var c = table.config, o = $(table);
22
- if(o.offset) {
23
- c.container.css({
24
- top: o.offset().top + o.height() + 'px',
25
- position: 'absolute'
26
- });
27
- }
28
- c.pagerPositionSet = true;
29
- }
30
- }
31
-
32
- function moveToFirstPage(table) {
33
- var c = table.config;
34
- c.page = 0;
35
- moveToPage(table);
36
- }
37
-
38
- function moveToLastPage(table) {
39
- var c = table.config;
40
- c.page = (c.totalPages-1);
41
- moveToPage(table);
42
- }
43
-
44
- function moveToNextPage(table) {
45
- var c = table.config;
46
- c.page++;
47
- if(c.page >= (c.totalPages-1)) {
48
- c.page = (c.totalPages-1);
49
- }
50
- moveToPage(table);
51
- }
52
-
53
- function moveToPrevPage(table) {
54
- var c = table.config;
55
- c.page--;
56
- if(c.page <= 0) {
57
- c.page = 0;
58
- }
59
- moveToPage(table);
60
- }
61
-
62
-
63
- function moveToPage(table) {
64
- var c = table.config;
65
- if(c.page < 0 || c.page > (c.totalPages-1)) {
66
- c.page = 0;
67
- }
68
-
69
- renderTable(table,c.rowsCopy);
70
- }
71
-
72
- function renderTable(table,rows) {
73
-
74
- var c = table.config;
75
- var l = rows.length;
76
- var s = (c.page * c.size);
77
- var e = (s + c.size);
78
- if(e > rows.length ) {
79
- e = rows.length;
80
- }
81
-
82
-
83
- var tableBody = $(table.tBodies[0]);
84
-
85
- // clear the table body
86
-
87
- $.tablesorter.clearTableBody(table);
88
-
89
- for(var i = s; i < e; i++) {
90
-
91
- //tableBody.append(rows[i]);
92
-
93
- var o = rows[i];
94
- var l = o.length;
95
- for(var j=0; j < l; j++) {
96
-
97
- tableBody[0].appendChild(o[j]);
98
-
99
- }
100
- }
101
-
102
- fixPosition(table,tableBody);
103
-
104
- $(table).trigger("applyWidgets");
105
-
106
- if( c.page >= c.totalPages ) {
107
- moveToLastPage(table);
108
- }
109
-
110
- updatePageDisplay(c);
111
- }
112
-
113
- this.appender = function(table,rows) {
114
-
115
- var c = table.config;
116
-
117
- c.rowsCopy = rows;
118
- c.totalRows = rows.length;
119
- c.totalPages = Math.ceil(c.totalRows / c.size);
120
-
121
- renderTable(table,rows);
122
- };
123
-
124
- this.defaults = {
125
- size: 10,
126
- offset: 0,
127
- page: 0,
128
- totalRows: 0,
129
- totalPages: 0,
130
- container: null,
131
- cssNext: '.next',
132
- cssPrev: '.prev',
133
- cssFirst: '.first',
134
- cssLast: '.last',
135
- cssPageDisplay: '.pagedisplay',
136
- cssPageSize: '.pagesize',
137
- seperator: "/",
138
- positionFixed: true,
139
- appender: this.appender
140
- };
141
-
142
- this.construct = function(settings) {
143
-
144
- return this.each(function() {
145
-
146
- config = $.extend(this.config, $.tablesorterPager.defaults, settings);
147
-
148
- var table = this, pager = config.container;
149
-
150
- $(this).trigger("appendCache");
151
-
152
- config.size = parseInt($(".pagesize",pager).val());
153
-
154
- $(config.cssFirst,pager).click(function() {
155
- moveToFirstPage(table);
156
- return false;
157
- });
158
- $(config.cssNext,pager).click(function() {
159
- moveToNextPage(table);
160
- return false;
161
- });
162
- $(config.cssPrev,pager).click(function() {
163
- moveToPrevPage(table);
164
- return false;
165
- });
166
- $(config.cssLast,pager).click(function() {
167
- moveToLastPage(table);
168
- return false;
169
- });
170
- $(config.cssPageSize,pager).change(function() {
171
- setPageSize(table,parseInt($(this).val()));
172
- return false;
173
- });
174
- });
175
- };
176
-
177
- }
178
- });
179
- // extend plugin scope
180
- $.fn.extend({
181
- tablesorterPager: $.tablesorterPager.construct
182
- });
183
-
184
- })(jQuery);
@@ -1,39 +0,0 @@
1
- /* tables */
2
- table.tablesorter {
3
- font-family:arial;
4
- background-color: #CDCDCD;
5
- margin:10px 0pt 15px;
6
- font-size: 8pt;
7
- width: 100%;
8
- text-align: left;
9
- }
10
- table.tablesorter thead tr th, table.tablesorter tfoot tr th {
11
- background-color: #e6EEEE;
12
- border: 1px solid #FFF;
13
- font-size: 8pt;
14
- padding: 4px;
15
- }
16
- table.tablesorter thead tr .header {
17
- background-image: asset-data-url('jquery-tablesorter/blue/bg.gif');
18
- background-repeat: no-repeat;
19
- background-position: center right;
20
- cursor: pointer;
21
- }
22
- table.tablesorter tbody td {
23
- color: #3D3D3D;
24
- padding: 4px;
25
- background-color: #FFF;
26
- vertical-align: top;
27
- }
28
- table.tablesorter tbody tr.odd td {
29
- background-color:#F0F0F6;
30
- }
31
- table.tablesorter thead tr .headerSortUp {
32
- background-image: asset-data-url('jquery-tablesorter/blue/asc.gif');
33
- }
34
- table.tablesorter thead tr .headerSortDown {
35
- background-image: asset-data-url('jquery-tablesorter/blue/desc.gif');
36
- }
37
- table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
38
- background-color: #8dbdd8;
39
- }
@@ -1,39 +0,0 @@
1
- table.tablesorter {
2
- font-size: 12px;
3
- background-color: #4D4D4D;
4
- width: 1024px;
5
- border: 1px solid #000;
6
- }
7
- table.tablesorter th {
8
- text-align: left;
9
- padding: 5px;
10
- background-color: #6E6E6E;
11
- }
12
- table.tablesorter td {
13
- color: #FFF;
14
- padding: 5px;
15
- }
16
- table.tablesorter .even {
17
- background-color: #3D3D3D;
18
- }
19
- table.tablesorter .odd {
20
- background-color: #6E6E6E;
21
- }
22
- table.tablesorter .header {
23
- background-image: asset-data-url('jquery-tablesorter/green/bg.png');
24
- background-repeat: no-repeat;
25
- border-left: 1px solid #FFF;
26
- border-right: 1px solid #000;
27
- border-top: 1px solid #FFF;
28
- padding-left: 30px;
29
- padding-top: 8px;
30
- height: auto;
31
- }
32
- table.tablesorter .headerSortUp {
33
- background-image: asset-data-url('jquery-tablesorter/green/asc.png');
34
- background-repeat: no-repeat;
35
- }
36
- table.tablesorter .headerSortDown {
37
- background-image: asset-data-url('jquery-tablesorter/green/desc.png');
38
- background-repeat: no-repeat;
39
- }