inputs.html
20.3 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
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
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
<!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">
<link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico">
<title>AutoFill example</title>
<style type="text/css" title="currentStyle">
@import "../../media/css/demo_page.css";
@import "../../media/css/demo_table.css";
@import "media/css/AutoFill.css";
td input { width: 90% }
</style>
<script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8" src="media/js/AutoFill.js"></script>
<script type="text/javascript" charset="utf-8">
$.fn.dataTableExt.afnSortData['dom-text'] = function ( oSettings, iColumn )
{
var aData = [];
$( 'td:eq('+iColumn+') input', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
aData.push( this.value );
} );
return aData;
}
$(document).ready( function () {
var oTable = $('#example').dataTable( {
"aoColumnDefs": [
{ "sSortDataType": "dom-text", "aTargets": [ "_all" ] },
{ "sType": "numeric", "aTargets": [ -2 ] }
]
} );
new AutoFill( oTable );
} );
</script>
</head>
<body id="dt_example">
<div id="container">
<div class="full_width big">
AutoFill example with input elements
</div>
<h1>Preamble</h1>
<p>
AutoFill works with Input elements and Select elements, as well as plain HTML cells. This
example shows all inputs cells, combined with DataTables' DOM sorting plug-in. You can
even combine input and plain HTML cells if you wanted (useful from something like jEditable).
</p>
<h1>Live example</h1>
<form>
<div id="demo">
<table class="display" id="example">
<thead>
<tr>
<th>Rendering engine</th>
<th>Browser</th>
<th>Platform(s)</th>
<th>Engine version</th>
<th>CSS grade</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Rendering engine</th>
<th>Browser</th>
<th>Platform(s)</th>
<th>Engine version</th>
<th>CSS grade</th>
</tr>
</tfoot>
<tbody>
<tr class="odd_gradeX">
<td><input type="text" value="Trident"></td>
<td><input type="text" value="Internet Explorer 4.0"></td>
<td><input type="text" value="Win 95+ (Entity: &)"></td>
<td class="center"><input type="text" value="4"></td>
<td class="center"><input type="text" value="X"></td>
</tr>
<tr class="even_gradeC">
<td><input type="text" value="Trident"></td>
<td><input type="text" value="Internet Explorer 5.0"></td>
<td><input type="text" value="Win 95+"></td>
<td class="center"><input type="text" value="5"></td>
<td class="center"><input type="text" value="C"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Trident"></td>
<td><input type="text" value="Internet Explorer 5.5"></td>
<td><input type="text" value="Win 95+"></td>
<td class="center"><input type="text" value="5.5"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Trident"></td>
<td><input type="text" value="Internet Explorer 6"></td>
<td><input type="text" value="Win 98+"></td>
<td class="center"><input type="text" value="6"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Trident"></td>
<td><input type="text" value="Internet Explorer 7"></td>
<td><input type="text" value="Win XP SP2+"></td>
<td class="center"><input type="text" value="7"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Trident"></td>
<td><input type="text" value="AOL browser (AOL desktop)"></td>
<td><input type="text" value="Win XP"></td>
<td class="center"><input type="text" value="6"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Gecko (UTF-8: $¢€)"></td>
<td><input type="text" value="Firefox 1.0"></td>
<td><input type="text" value="Win 98+ / OSX.2+"></td>
<td class="center"><input type="text" value="1.7"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Firefox 1.5"></td>
<td><input type="text" value="Win 98+ / OSX.2+"></td>
<td class="center"><input type="text" value="1.8"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Firefox 2.0"></td>
<td><input type="text" value="Win 98+ / OSX.2+"></td>
<td class="center"><input type="text" value="1.8"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Firefox 3.0"></td>
<td><input type="text" value="Win 2k+ / OSX.3+"></td>
<td class="center"><input type="text" value="1.9"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Camino 1.0"></td>
<td><input type="text" value="OSX.2+"></td>
<td class="center"><input type="text" value="1.8"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Camino 1.5"></td>
<td><input type="text" value="OSX.3+"></td>
<td class="center"><input type="text" value="1.8"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Netscape 7.2"></td>
<td><input type="text" value="Win 95+ / Mac OS 8.6-9.2"></td>
<td class="center"><input type="text" value="1.7"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Netscape Browser 8"></td>
<td><input type="text" value="Win 98SE+"></td>
<td class="center"><input type="text" value="1.7"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Netscape Navigator 9"></td>
<td><input type="text" value="Win 98+ / OSX.2+"></td>
<td class="center"><input type="text" value="1.8"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Mozilla 1.0"></td>
<td><input type="text" value="Win 95+ / OSX.1+"></td>
<td class="center"><input type="text" value="1"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Mozilla 1.1"></td>
<td><input type="text" value="Win 95+ / OSX.1+"></td>
<td class="center"><input type="text" value="1.1"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Mozilla 1.2"></td>
<td><input type="text" value="Win 95+ / OSX.1+"></td>
<td class="center"><input type="text" value="1.2"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Mozilla 1.3"></td>
<td><input type="text" value="Win 95+ / OSX.1+"></td>
<td class="center"><input type="text" value="1.3"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Mozilla 1.4"></td>
<td><input type="text" value="Win 95+ / OSX.1+"></td>
<td class="center"><input type="text" value="1.4"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Mozilla 1.5"></td>
<td><input type="text" value="Win 95+ / OSX.1+"></td>
<td class="center"><input type="text" value="1.5"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Mozilla 1.6"></td>
<td><input type="text" value="Win 95+ / OSX.1+"></td>
<td class="center"><input type="text" value="1.6"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Mozilla 1.7"></td>
<td><input type="text" value="Win 98+ / OSX.1+"></td>
<td class="center"><input type="text" value="1.7"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Mozilla 1.8"></td>
<td><input type="text" value="Win 98+ / OSX.1+"></td>
<td class="center"><input type="text" value="1.8"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Seamonkey 1.1"></td>
<td><input type="text" value="Win 98+ / OSX.2+"></td>
<td class="center"><input type="text" value="1.8"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Gecko"></td>
<td><input type="text" value="Epiphany 2.20"></td>
<td><input type="text" value="Gnome"></td>
<td class="center"><input type="text" value="1.8"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Webkit"></td>
<td><input type="text" value="Safari 1.2"></td>
<td><input type="text" value="OSX.3"></td>
<td class="center"><input type="text" value="125.5"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Webkit"></td>
<td><input type="text" value="Safari 1.3"></td>
<td><input type="text" value="OSX.3"></td>
<td class="center"><input type="text" value="312.8"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Webkit"></td>
<td><input type="text" value="Safari 2.0"></td>
<td><input type="text" value="OSX.4+"></td>
<td class="center"><input type="text" value="419.3"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Webkit"></td>
<td><input type="text" value="Safari 3.0"></td>
<td><input type="text" value="OSX.4+"></td>
<td class="center"><input type="text" value="522.1"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Webkit"></td>
<td><input type="text" value="OmniWeb 5.5"></td>
<td><input type="text" value="OSX.4+"></td>
<td class="center"><input type="text" value="420"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Webkit"></td>
<td><input type="text" value="iPod Touch / iPhone"></td>
<td><input type="text" value="iPod"></td>
<td class="center"><input type="text" value="420.1"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Webkit"></td>
<td><input type="text" value="S60"></td>
<td><input type="text" value="S60"></td>
<td class="center"><input type="text" value="413"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Presto"></td>
<td><input type="text" value="Opera 7.0"></td>
<td><input type="text" value="Win 95+ / OSX.1+"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Presto"></td>
<td><input type="text" value="Opera 7.5"></td>
<td><input type="text" value="Win 95+ / OSX.2+"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Presto"></td>
<td><input type="text" value="Opera 8.0"></td>
<td><input type="text" value="Win 95+ / OSX.2+"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Presto"></td>
<td><input type="text" value="Opera 8.5"></td>
<td><input type="text" value="Win 95+ / OSX.2+"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Presto"></td>
<td><input type="text" value="Opera 9.0"></td>
<td><input type="text" value="Win 95+ / OSX.3+"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Presto"></td>
<td><input type="text" value="Opera 9.2"></td>
<td><input type="text" value="Win 88+ / OSX.3+"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Presto"></td>
<td><input type="text" value="Opera 9.5"></td>
<td><input type="text" value="Win 88+ / OSX.3+"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Presto"></td>
<td><input type="text" value="Opera for Wii"></td>
<td><input type="text" value="Wii"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Presto"></td>
<td><input type="text" value="Nokia N800"></td>
<td><input type="text" value="N800"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Presto"></td>
<td><input type="text" value="Nintendo DS browser"></td>
<td><input type="text" value="Nintendo DS"></td>
<td class="center"><input type="text" value="8.5"></td>
<td class="center"><input type="text" value="C/A<sup>1</sup>"></td>
</tr>
<tr class="even_gradeC">
<td><input type="text" value="KHTML"></td>
<td><input type="text" value="Konqureror 3.1"></td>
<td><input type="text" value="KDE 3.1"></td>
<td class="center"><input type="text" value="3.1"></td>
<td class="center"><input type="text" value="C"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="KHTML"></td>
<td><input type="text" value="Konqureror 3.3"></td>
<td><input type="text" value="KDE 3.3"></td>
<td class="center"><input type="text" value="3.3"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="KHTML"></td>
<td><input type="text" value="Konqureror 3.5"></td>
<td><input type="text" value="KDE 3.5"></td>
<td class="center"><input type="text" value="3.5"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="odd_gradeX">
<td><input type="text" value="Tasman"></td>
<td><input type="text" value="Internet Explorer 4.5"></td>
<td><input type="text" value="Mac OS 8-9"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="X"></td>
</tr>
<tr class="even_gradeC">
<td><input type="text" value="Tasman"></td>
<td><input type="text" value="Internet Explorer 5.1"></td>
<td><input type="text" value="Mac OS 7.6-9"></td>
<td class="center"><input type="text" value="1"></td>
<td class="center"><input type="text" value="C"></td>
</tr>
<tr class="odd_gradeC">
<td><input type="text" value="Tasman"></td>
<td><input type="text" value="Internet Explorer 5.2"></td>
<td><input type="text" value="Mac OS 8-X"></td>
<td class="center"><input type="text" value="1"></td>
<td class="center"><input type="text" value="C"></td>
</tr>
<tr class="even_gradeA">
<td><input type="text" value="Misc"></td>
<td><input type="text" value="NetFront 3.1"></td>
<td><input type="text" value="Embedded devices"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="C"></td>
</tr>
<tr class="odd_gradeA">
<td><input type="text" value="Misc"></td>
<td><input type="text" value="NetFront 3.4"></td>
<td><input type="text" value="Embedded devices"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="A"></td>
</tr>
<tr class="even_gradeX">
<td><input type="text" value="Misc"></td>
<td><input type="text" value="Dillo 0.8"></td>
<td><input type="text" value="Embedded devices"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="X"></td>
</tr>
<tr class="odd_gradeX">
<td><input type="text" value="Misc"></td>
<td><input type="text" value="Links"></td>
<td><input type="text" value="Text only"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="X"></td>
</tr>
<tr class="even_gradeX">
<td><input type="text" value="Misc"></td>
<td><input type="text" value="Lynx"></td>
<td><input type="text" value="Text only"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="X"></td>
</tr>
<tr class="odd_gradeC">
<td><input type="text" value="Misc"></td>
<td><input type="text" value="IE Mobile"></td>
<td><input type="text" value="Windows Mobile 6"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="C"></td>
</tr>
<tr class="even_gradeC">
<td><input type="text" value="Misc"></td>
<td><input type="text" value="PSP browser"></td>
<td><input type="text" value="PSP"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="C"></td>
</tr>
<tr class="odd_gradeU">
<td><input type="text" value="Other browsers"></td>
<td><input type="text" value="All others"></td>
<td><input type="text" value="-"></td>
<td class="center"><input type="text" value="-"></td>
<td class="center"><input type="text" value="U"></td>
</tr>
</tbody>
</table>
</div>
</form>
<div class="spacer"></div>
<h1>Examples</h1>
<ul>
<li><a href="index.html">Basic initialisation</a></li>
<li><a href="columns.html">Selecting which columns to provide AutoFill on</a></li>
<li><a href="scrolling.html">Scrolling a DataTable using fill</a></li>
<li><a href="inputs.html">Using with input elements</a></li>
<li><a href="callbacks.html">Customisation using callback functions</a></li>
</ul>
<h1>Initialisation code</h1>
<pre>$.fn.dataTableExt.afnSortData['dom-text'] = function ( oSettings, iColumn )
{
var aData = [];
$( 'td:eq('+iColumn+') input', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
aData.push( this.value );
} );
return aData;
}
$(document).ready( function () {
var oTable = $('#example').dataTable( {
"aoColumnDefs": [
{ "sSortDataType": "dom-text", "aTargets": [ "_all" ] },
{ "sType": "numeric", "aTargets": [ -2 ] }
]
} );
new AutoFill( oTable );
} );</pre>
<div id="footer" style="text-align:center;">
<span style="font-size:10px;">
AutoFill and DataTables © Allan Jardine 2009-2010.<br>
</span>
</div>
</div>
</body>
</html>