-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsmartpaginator.htm
495 lines (489 loc) · 18.3 KB
/
smartpaginator.htm
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Smart Pagination</title>
<script src="jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="smartpaginator.js" type="text/javascript"></script>
<link href="smartpaginator.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function () {
$('#green-contents').css('display', 'none');
$('#black-contents').css('display', 'none');
$('ul li').click(function () {
$('#red-contents').css('display', 'none');
$('#green-contents').css('display', 'none');
$('#black-contents').css('display', 'none');
if ($(this).attr('id') == '1') $('#red-contents').css('display', '');
if ($(this).attr('id') == '2') $('#green-contents').css('display', '');
if ($(this).attr('id') == '3') $('#black-contents').css('display', '');
});
$('#green').smartpaginator({ totalrecords: 10, recordsperpage: 3, datacontainer: 'mt', dataelement: 'tr', initval: 0, next: 'Next', prev: 'Prev', first: 'First', last: 'Last', theme: 'green' });
$('#black').smartpaginator({ totalrecords: 5, recordsperpage: 1, datacontainer: 'divs', dataelement: 'div', initval: 0, next: 'Next', prev: 'Prev', first: 'First', last: 'Last', theme: 'black' });
$('#red').smartpaginator({ totalrecords: 32, recordsperpage: 4, length: 4, next: 'Next', prev: 'Prev', first: 'First', last: 'Last', theme: 'red', controlsalways: true, onchange: function (newPage) {
$('#r').html('Page # ' + newPage);
}
});
});
</script>
<style type="text/css">
body
{
padding: 20px;
}
#wrapper
{
margin: auto;
width: 800px;
}
.contents
{
width: 91%; /*height: 150px;*/
margin: 0;
}
.contents > p
{
padding: 8px;
}
.table
{
width: 100%;
border-right: solid 1px #5f9000;
}
.table th, .table td
{
width: 16%;
height: 20px;
padding: 4px;
text-align: left;
}
.table th
{
border-left: solid 1px #5f9000;
}
.table td
{
border-left: solid 1px #5f9000;
border-bottom: solid 1px #5f9000;
}
.header
{
background-color: #4f7305;
color: White;
}
#divs
{
margin: 0;
height: 200px;
font: verdana;
font-size: 14px;
background-color: White;
}
#divs > div
{
width: 98%;
padding: 8px;
}
#divs > div p
{
width: 95%;
padding: 8px;
}
ul.tab
{
list-style: none;
margin: 0;
padding: 0;
}
ul.tab li
{
display: inline;
padding: 10px;
color: White;
cursor: pointer;
}
#container
{
width: 100%;
border: solid 1px red;
}
.demobar
{
height: 90px;
line-height: 90px;
}
.demobar .fleft
{
float: left;
margin-left: 10px;
}
.demobar .fright
{
float: right;
margin-top: 14px;
margin-right: 10px;
}
</style>
</head>
<body>
<div id="wrapper">
<div style="height: 30px;">
<ul class="tab">
<li style="background-color: #E71C18; border: solid 1px #F82723;" id="1">Demo 1</li>
<li style="background-color: #588500; border: solid 1px #5f9000;" id="2">Demo 2</li>
<li style="background-color: #1d1d1d; border: solid 1px #000;" id="3">Demo 3</li>
</ul>
</div>
<div id="red-contents" class="contents" style="border: solid 1px #F82723;">
<pre>
$('#red').smartpaginator({ totalrecords: 100,
recordsperpage: 10,
theme: 'red',
controlsalways:true,
onchange: function(newPage) {
$('#r').html('Page # ' + newPage);
}
});
</pre>
<p>
This demo shows the use of onchange callback, on each page click you'll get the
new page no. So, you can pull data from your datasource, probably database or some
xml file. Smart Pagination can also filter your data automatically, this is usefull
if you only want client side pagination. Obvioulsy this will be suitable only for
small data. It also keeps first,prev,next, last buttons always visible using the
'controlsalways' property. Click on Demo 2 to see and example.
</p>
<div style="height: 65px; text-align: center; font-size: 2em; padding-top: 40px;
color: #F82723" id="r">
Page # 1
</div>
<div id="red" style="margin: auto;">
</div>
</div>
<div id="green-contents" class="contents" style="border: solid 1px #5f9000;">
<pre>
$('#green').smartpaginator({ totalrecords: 10,
recordsperpage: 3,
datacontainer: 'mt',
dataelement: 'tr',
theme: 'green' });
</pre>
<p>
This demo shows how Smart Paginator can filter your data automatically. Here we
have an HTML table with 10 rows and 6 columns, and we want 3 recods to be displayed
on each page. For this you need to pass the id of the HTML table you want Smart
Paginator to filter see the datacontainer property, and you also need to set the
dataelement tag which is 'tr' for a table. 'datacontainer' and 'dataelement' properties
establish parent child relation, you can pass any element other than table as 'datacontainer'
and set the 'dataelement', Smart Paginator will filter the 'dataelements' gracefull.
See Demo 3 for for an example of this.
</p>
<table id="mt" cellpadding="0" cellspacing="0" border="0" class="table">
<tr class="header">
<th>
Col1
</th>
<th>
Col2
</th>
<th>
Col3
</th>
<th>
Col4
</th>
<th>
Col5
</th>
<th>
Col6
</th>
</tr>
<tr>
<td>
01
</td>
<td>
02
</td>
<td>
03
</td>
<td>
04
</td>
<td>
05
</td>
<td>
06
</td>
</tr>
<tr>
<td>
11
</td>
<td>
12
</td>
<td>
13
</td>
<td>
14
</td>
<td>
15
</td>
<td>
16
</td>
</tr>
<tr>
<td>
21
</td>
<td>
22
</td>
<td>
23
</td>
<td>
24
</td>
<td>
25
</td>
<td>
26
</td>
</tr>
<tr>
<td>
31
</td>
<td>
32
</td>
<td>
33
</td>
<td>
34
</td>
<td>
35
</td>
<td>
36
</td>
</tr>
<tr>
<td>
41
</td>
<td>
42
</td>
<td>
43
</td>
<td>
44
</td>
<td>
45
</td>
<td>
46
</td>
</tr>
<tr>
<td>
51
</td>
<td>
52
</td>
<td>
53
</td>
<td>
54
</td>
<td>
55
</td>
<td>
56
</td>
</tr>
<tr>
<td>
61
</td>
<td>
62
</td>
<td>
63
</td>
<td>
64
</td>
<td>
65
</td>
<td>
66
</td>
</tr>
<tr>
<td>
71
</td>
<td>
72
</td>
<td>
73
</td>
<td>
74
</td>
<td>
75
</td>
<td>
76
</td>
</tr>
<tr>
<td>
81
</td>
<td>
82
</td>
<td>
83
</td>
<td>
84
</td>
<td>
85
</td>
<td>
86
</td>
</tr>
<tr>
<td>
91
</td>
<td>
92
</td>
<td>
93
</td>
<td>
94
</td>
<td>
95
</td>
<td>
96
</td>
</tr>
</table>
<div id="green" style="margin: auto;">
</div>
</div>
<div id="black-contents" class="contents" style="border: solid 1px #000;">
<pre>
$('#black').smartpaginator({ totalrecords: 5,
recordsperpage: 1,
datacontainer: 'divs',
dataelement: 'div',
theme: 'black' });
</pre>
<p>
This demo shows the use of Smart Paginator with HTML elements other than table.
See how divs are displayed according to current page.
</p>
<div id="divs">
<div>
<h4>
<a href="http://www.egrappler.com/jquery-content-slider-jscarousel/">jQuery Content
Slider: jsCarousel</a></h4>
<p>
jsCarousel is a jquery slider plugin that slides contents in multi direction. jsCarousel
slider can be used as a feature content slider as well. You can put any kind of
contents you want whether images, text, videos, news etc. it's up to you. One interesting
thing about jsCarousel slider is that you can make simple image gallery with thumbnail
support by using it. jsCarousel slider plugin gives you the source of image via
callback function, when you click on some image within slider. See Using jsCarousel
Slider section below to get an idea about using the callback function.
</p>
</div>
<div>
<h4>
<a href="http://www.egrappler.com/jquery-image-preload-plugin-smart-preloader/">jQuery
Image Preload Plugin: Smart Preload</a></h4>
<p>
Smart Preloader is a small jQuery image preloading plugin that helps you preload
all the required images. Smart perloader plugin takes an array of images and notifies
via "oneachimageload" on each image load, and once all the images are loaded "onloadall"
callback functions is called. Both the "oneachimageload" and "onloadall" functions
are passed as parameters to Smart Preloader initializer function.</p>
</div>
<div>
<h4>
<a href="http://www.egrappler.com/jquery-pagination-plugin-smart-paginator/">jQuery
Pagination Plugin: Smart Paginator</a></h4>
<p>
Smart Paginator is a comprehensive jQuery Pagination plugin that makes adding pagination
very simple task, all the navigation logic is built in and it is also very customizable.
Smart Paginator supports variety of parameters and custom themes, that can be used
to customize the look and feel to your desire.</p>
</div>
<div>
<h4>
<a href="http://www.egrappler.com/jquery-spin-button-plugin-smart-spin/">jQuery Spin
Button Plugin: Smart Spin</a></h4>
<p>
Smart spin is a jQuery spin button plugin that mimics the very common windows spin
button control. Smart spin allows you to select a value between minimum and maximum
values using either mouse or keyboard. You can also enter a value via keyboard.
Smart spin contains a text box and "up" "down" buttons, it also supports "masking"(text
that appears when the control looses focus). Clicking the "up" button causes the
value to increment by step value (step value is configurable, default is 1), while
clicking the "down" button causes the value to decrement by step value. Clicking
up/down buttons and holding the left mouse button causes the values to change more
rapidly.
</p>
</div>
<div>
<h4>
<a href="http://www.egrappler.com/jquery-slidertrackbar-smart-slider/">jQuery Slider/Trackbar
Plugin: Smart Slider</a></h4>
<p>
Smart Slider is a jQuery plugin that mimics the very common user interface track
bar component, which consists of a slider bar and tracker/pointer, where tracker
can be moved back and forth along the slider bar to select a value. Smart Slider
comes in three different styles with variety of custom parameters. You can also
use your own custom styles simply by defining your custom CSS classes. Smart Slider
supports different styles and custom themes. Using Smart Slider plugin is also very
simple, you just need a block element, Smart Slider script and CSS file, Smart Slider
automatically generate track bar UI.</p>
</div>
</div>
<div id="black" style="margin: auto;">
</div>
</div>
</div> </body>
</html>