Project

General

Profile

1
<!DOCTYPE html>
2
<html>
3
<head>
4
	<meta charset="utf-8">
5
	<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
6
	<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
7

    
8
	<title>TableTools example - Bootstrap styling</title>
9
	<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
10
	<link rel="stylesheet" type="text/css" href=
11
	"//cdn.datatables.net/plug-ins/505bef35b56/integration/bootstrap/3/dataTables.bootstrap.css">
12
	<link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
13
	<link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
14
	<style type="text/css" class="init">
15

    
16
	body { font-size: 140%; }
17
	div.DTTT { margin-bottom: 0.5em; float: right; }
18
	div.dataTables_wrapper { clear: both; }
19

    
20
	</style>
21
	<script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
22
	<script type="text/javascript" language="javascript" src="../../../media/js/jquery.dataTables.js"></script>
23
	<script type="text/javascript" language="javascript" src="../js/dataTables.tableTools.js"></script>
24
	<script type="text/javascript" language="javascript" src=
25
	"//cdn.datatables.net/plug-ins/505bef35b56/integration/bootstrap/3/dataTables.bootstrap.js"></script>
26
	<script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
27
	<script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
28
	<script type="text/javascript" language="javascript" class="init">
29

    
30

    
31
$(document).ready(function() {
32
	var table = $('#example').DataTable();
33
	var tt = new $.fn.dataTable.TableTools( table );
34

    
35
	$( tt.fnContainer() ).insertBefore('div.dataTables_wrapper');
36
} );
37

    
38

    
39
	</script>
40
</head>
41

    
42
<body class="dt-example">
43
	<div class="container">
44
		<section>
45
			<h1>TableTools example <span>Bootstrap styling</span></h1>
46

    
47
			<div class="info">
48
				<p><a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a> is a very powerful design
49
				framework for allowing you to very quickly create applications with a unified look and feel. <a href=
50
				"http://datatables.net/manual/styling/bootstrap">DataTables integrates well</a> with Bootstrap, and so
51
				does TableTools.</p>
52

    
53
				<p>This example shows the default Bootstrap theme being used with a Bootstrap styled DataTable. The
54
				<a href="new_init.html"><code>new</code></a> form of initialising TableTools is used here, as the
55
				Bootstrap integration uses a complex <a href="//datatables.net/reference/option/dom"><code class=
56
				"option" title="DataTables initialisation option">dom<span>DT</span></code></a> option (it is possible
57
				to provide a custom <a href="//datatables.net/reference/option/dom"><code class="option" title=
58
				"DataTables initialisation option">dom<span>DT</span></code></a> option if you want to, this is just
59
				for simplicity!).</p>
60
			</div>
61

    
62
			<table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%">
63
				<thead>
64
					<tr>
65
						<th>Name</th>
66
						<th>Position</th>
67
						<th>Office</th>
68
						<th>Age</th>
69
						<th>Start date</th>
70
						<th>Salary</th>
71
					</tr>
72
				</thead>
73

    
74
				<tfoot>
75
					<tr>
76
						<th>Name</th>
77
						<th>Position</th>
78
						<th>Office</th>
79
						<th>Age</th>
80
						<th>Start date</th>
81
						<th>Salary</th>
82
					</tr>
83
				</tfoot>
84

    
85
				<tbody>
86
					<tr>
87
						<td>Tiger Nixon</td>
88
						<td>System Architect</td>
89
						<td>Edinburgh</td>
90
						<td>61</td>
91
						<td>2011/04/25</td>
92
						<td>$320,800</td>
93
					</tr>
94
					<tr>
95
						<td>Garrett Winters</td>
96
						<td>Accountant</td>
97
						<td>Tokyo</td>
98
						<td>63</td>
99
						<td>2011/07/25</td>
100
						<td>$170,750</td>
101
					</tr>
102
					<tr>
103
						<td>Ashton Cox</td>
104
						<td>Junior Technical Author</td>
105
						<td>San Francisco</td>
106
						<td>66</td>
107
						<td>2009/01/12</td>
108
						<td>$86,000</td>
109
					</tr>
110
					<tr>
111
						<td>Cedric Kelly</td>
112
						<td>Senior Javascript Developer</td>
113
						<td>Edinburgh</td>
114
						<td>22</td>
115
						<td>2012/03/29</td>
116
						<td>$433,060</td>
117
					</tr>
118
					<tr>
119
						<td>Airi Satou</td>
120
						<td>Accountant</td>
121
						<td>Tokyo</td>
122
						<td>33</td>
123
						<td>2008/11/28</td>
124
						<td>$162,700</td>
125
					</tr>
126
					<tr>
127
						<td>Brielle Williamson</td>
128
						<td>Integration Specialist</td>
129
						<td>New York</td>
130
						<td>61</td>
131
						<td>2012/12/02</td>
132
						<td>$372,000</td>
133
					</tr>
134
					<tr>
135
						<td>Herrod Chandler</td>
136
						<td>Sales Assistant</td>
137
						<td>San Francisco</td>
138
						<td>59</td>
139
						<td>2012/08/06</td>
140
						<td>$137,500</td>
141
					</tr>
142
					<tr>
143
						<td>Rhona Davidson</td>
144
						<td>Integration Specialist</td>
145
						<td>Tokyo</td>
146
						<td>55</td>
147
						<td>2010/10/14</td>
148
						<td>$327,900</td>
149
					</tr>
150
					<tr>
151
						<td>Colleen Hurst</td>
152
						<td>Javascript Developer</td>
153
						<td>San Francisco</td>
154
						<td>39</td>
155
						<td>2009/09/15</td>
156
						<td>$205,500</td>
157
					</tr>
158
					<tr>
159
						<td>Sonya Frost</td>
160
						<td>Software Engineer</td>
161
						<td>Edinburgh</td>
162
						<td>23</td>
163
						<td>2008/12/13</td>
164
						<td>$103,600</td>
165
					</tr>
166
					<tr>
167
						<td>Jena Gaines</td>
168
						<td>Office Manager</td>
169
						<td>London</td>
170
						<td>30</td>
171
						<td>2008/12/19</td>
172
						<td>$90,560</td>
173
					</tr>
174
					<tr>
175
						<td>Quinn Flynn</td>
176
						<td>Support Lead</td>
177
						<td>Edinburgh</td>
178
						<td>22</td>
179
						<td>2013/03/03</td>
180
						<td>$342,000</td>
181
					</tr>
182
					<tr>
183
						<td>Charde Marshall</td>
184
						<td>Regional Director</td>
185
						<td>San Francisco</td>
186
						<td>36</td>
187
						<td>2008/10/16</td>
188
						<td>$470,600</td>
189
					</tr>
190
					<tr>
191
						<td>Haley Kennedy</td>
192
						<td>Senior Marketing Designer</td>
193
						<td>London</td>
194
						<td>43</td>
195
						<td>2012/12/18</td>
196
						<td>$313,500</td>
197
					</tr>
198
					<tr>
199
						<td>Tatyana Fitzpatrick</td>
200
						<td>Regional Director</td>
201
						<td>London</td>
202
						<td>19</td>
203
						<td>2010/03/17</td>
204
						<td>$385,750</td>
205
					</tr>
206
					<tr>
207
						<td>Michael Silva</td>
208
						<td>Marketing Designer</td>
209
						<td>London</td>
210
						<td>66</td>
211
						<td>2012/11/27</td>
212
						<td>$198,500</td>
213
					</tr>
214
					<tr>
215
						<td>Paul Byrd</td>
216
						<td>Chief Financial Officer (CFO)</td>
217
						<td>New York</td>
218
						<td>64</td>
219
						<td>2010/06/09</td>
220
						<td>$725,000</td>
221
					</tr>
222
					<tr>
223
						<td>Gloria Little</td>
224
						<td>Systems Administrator</td>
225
						<td>New York</td>
226
						<td>59</td>
227
						<td>2009/04/10</td>
228
						<td>$237,500</td>
229
					</tr>
230
					<tr>
231
						<td>Bradley Greer</td>
232
						<td>Software Engineer</td>
233
						<td>London</td>
234
						<td>41</td>
235
						<td>2012/10/13</td>
236
						<td>$132,000</td>
237
					</tr>
238
					<tr>
239
						<td>Dai Rios</td>
240
						<td>Personnel Lead</td>
241
						<td>Edinburgh</td>
242
						<td>35</td>
243
						<td>2012/09/26</td>
244
						<td>$217,500</td>
245
					</tr>
246
					<tr>
247
						<td>Jenette Caldwell</td>
248
						<td>Development Lead</td>
249
						<td>New York</td>
250
						<td>30</td>
251
						<td>2011/09/03</td>
252
						<td>$345,000</td>
253
					</tr>
254
					<tr>
255
						<td>Yuri Berry</td>
256
						<td>Chief Marketing Officer (CMO)</td>
257
						<td>New York</td>
258
						<td>40</td>
259
						<td>2009/06/25</td>
260
						<td>$675,000</td>
261
					</tr>
262
					<tr>
263
						<td>Caesar Vance</td>
264
						<td>Pre-Sales Support</td>
265
						<td>New York</td>
266
						<td>21</td>
267
						<td>2011/12/12</td>
268
						<td>$106,450</td>
269
					</tr>
270
					<tr>
271
						<td>Doris Wilder</td>
272
						<td>Sales Assistant</td>
273
						<td>Sidney</td>
274
						<td>23</td>
275
						<td>2010/09/20</td>
276
						<td>$85,600</td>
277
					</tr>
278
					<tr>
279
						<td>Angelica Ramos</td>
280
						<td>Chief Executive Officer (CEO)</td>
281
						<td>London</td>
282
						<td>47</td>
283
						<td>2009/10/09</td>
284
						<td>$1,200,000</td>
285
					</tr>
286
					<tr>
287
						<td>Gavin Joyce</td>
288
						<td>Developer</td>
289
						<td>Edinburgh</td>
290
						<td>42</td>
291
						<td>2010/12/22</td>
292
						<td>$92,575</td>
293
					</tr>
294
					<tr>
295
						<td>Jennifer Chang</td>
296
						<td>Regional Director</td>
297
						<td>Singapore</td>
298
						<td>28</td>
299
						<td>2010/11/14</td>
300
						<td>$357,650</td>
301
					</tr>
302
					<tr>
303
						<td>Brenden Wagner</td>
304
						<td>Software Engineer</td>
305
						<td>San Francisco</td>
306
						<td>28</td>
307
						<td>2011/06/07</td>
308
						<td>$206,850</td>
309
					</tr>
310
					<tr>
311
						<td>Fiona Green</td>
312
						<td>Chief Operating Officer (COO)</td>
313
						<td>San Francisco</td>
314
						<td>48</td>
315
						<td>2010/03/11</td>
316
						<td>$850,000</td>
317
					</tr>
318
					<tr>
319
						<td>Shou Itou</td>
320
						<td>Regional Marketing</td>
321
						<td>Tokyo</td>
322
						<td>20</td>
323
						<td>2011/08/14</td>
324
						<td>$163,000</td>
325
					</tr>
326
					<tr>
327
						<td>Michelle House</td>
328
						<td>Integration Specialist</td>
329
						<td>Sidney</td>
330
						<td>37</td>
331
						<td>2011/06/02</td>
332
						<td>$95,400</td>
333
					</tr>
334
					<tr>
335
						<td>Suki Burks</td>
336
						<td>Developer</td>
337
						<td>London</td>
338
						<td>53</td>
339
						<td>2009/10/22</td>
340
						<td>$114,500</td>
341
					</tr>
342
					<tr>
343
						<td>Prescott Bartlett</td>
344
						<td>Technical Author</td>
345
						<td>London</td>
346
						<td>27</td>
347
						<td>2011/05/07</td>
348
						<td>$145,000</td>
349
					</tr>
350
					<tr>
351
						<td>Gavin Cortez</td>
352
						<td>Team Leader</td>
353
						<td>San Francisco</td>
354
						<td>22</td>
355
						<td>2008/10/26</td>
356
						<td>$235,500</td>
357
					</tr>
358
					<tr>
359
						<td>Martena Mccray</td>
360
						<td>Post-Sales support</td>
361
						<td>Edinburgh</td>
362
						<td>46</td>
363
						<td>2011/03/09</td>
364
						<td>$324,050</td>
365
					</tr>
366
					<tr>
367
						<td>Unity Butler</td>
368
						<td>Marketing Designer</td>
369
						<td>San Francisco</td>
370
						<td>47</td>
371
						<td>2009/12/09</td>
372
						<td>$85,675</td>
373
					</tr>
374
					<tr>
375
						<td>Howard Hatfield</td>
376
						<td>Office Manager</td>
377
						<td>San Francisco</td>
378
						<td>51</td>
379
						<td>2008/12/16</td>
380
						<td>$164,500</td>
381
					</tr>
382
					<tr>
383
						<td>Hope Fuentes</td>
384
						<td>Secretary</td>
385
						<td>San Francisco</td>
386
						<td>41</td>
387
						<td>2010/02/12</td>
388
						<td>$109,850</td>
389
					</tr>
390
					<tr>
391
						<td>Vivian Harrell</td>
392
						<td>Financial Controller</td>
393
						<td>San Francisco</td>
394
						<td>62</td>
395
						<td>2009/02/14</td>
396
						<td>$452,500</td>
397
					</tr>
398
					<tr>
399
						<td>Timothy Mooney</td>
400
						<td>Office Manager</td>
401
						<td>London</td>
402
						<td>37</td>
403
						<td>2008/12/11</td>
404
						<td>$136,200</td>
405
					</tr>
406
					<tr>
407
						<td>Jackson Bradshaw</td>
408
						<td>Director</td>
409
						<td>New York</td>
410
						<td>65</td>
411
						<td>2008/09/26</td>
412
						<td>$645,750</td>
413
					</tr>
414
					<tr>
415
						<td>Olivia Liang</td>
416
						<td>Support Engineer</td>
417
						<td>Singapore</td>
418
						<td>64</td>
419
						<td>2011/02/03</td>
420
						<td>$234,500</td>
421
					</tr>
422
					<tr>
423
						<td>Bruno Nash</td>
424
						<td>Software Engineer</td>
425
						<td>London</td>
426
						<td>38</td>
427
						<td>2011/05/03</td>
428
						<td>$163,500</td>
429
					</tr>
430
					<tr>
431
						<td>Sakura Yamamoto</td>
432
						<td>Support Engineer</td>
433
						<td>Tokyo</td>
434
						<td>37</td>
435
						<td>2009/08/19</td>
436
						<td>$139,575</td>
437
					</tr>
438
					<tr>
439
						<td>Thor Walton</td>
440
						<td>Developer</td>
441
						<td>New York</td>
442
						<td>61</td>
443
						<td>2013/08/11</td>
444
						<td>$98,540</td>
445
					</tr>
446
					<tr>
447
						<td>Finn Camacho</td>
448
						<td>Support Engineer</td>
449
						<td>San Francisco</td>
450
						<td>47</td>
451
						<td>2009/07/07</td>
452
						<td>$87,500</td>
453
					</tr>
454
					<tr>
455
						<td>Serge Baldwin</td>
456
						<td>Data Coordinator</td>
457
						<td>Singapore</td>
458
						<td>64</td>
459
						<td>2012/04/09</td>
460
						<td>$138,575</td>
461
					</tr>
462
					<tr>
463
						<td>Zenaida Frank</td>
464
						<td>Software Engineer</td>
465
						<td>New York</td>
466
						<td>63</td>
467
						<td>2010/01/04</td>
468
						<td>$125,250</td>
469
					</tr>
470
					<tr>
471
						<td>Zorita Serrano</td>
472
						<td>Software Engineer</td>
473
						<td>San Francisco</td>
474
						<td>56</td>
475
						<td>2012/06/01</td>
476
						<td>$115,000</td>
477
					</tr>
478
					<tr>
479
						<td>Jennifer Acosta</td>
480
						<td>Junior Javascript Developer</td>
481
						<td>Edinburgh</td>
482
						<td>43</td>
483
						<td>2013/02/01</td>
484
						<td>$75,650</td>
485
					</tr>
486
					<tr>
487
						<td>Cara Stevens</td>
488
						<td>Sales Assistant</td>
489
						<td>New York</td>
490
						<td>46</td>
491
						<td>2011/12/06</td>
492
						<td>$145,600</td>
493
					</tr>
494
					<tr>
495
						<td>Hermione Butler</td>
496
						<td>Regional Director</td>
497
						<td>London</td>
498
						<td>47</td>
499
						<td>2011/03/21</td>
500
						<td>$356,250</td>
501
					</tr>
502
					<tr>
503
						<td>Lael Greer</td>
504
						<td>Systems Administrator</td>
505
						<td>London</td>
506
						<td>21</td>
507
						<td>2009/02/27</td>
508
						<td>$103,500</td>
509
					</tr>
510
					<tr>
511
						<td>Jonas Alexander</td>
512
						<td>Developer</td>
513
						<td>San Francisco</td>
514
						<td>30</td>
515
						<td>2010/07/14</td>
516
						<td>$86,500</td>
517
					</tr>
518
					<tr>
519
						<td>Shad Decker</td>
520
						<td>Regional Director</td>
521
						<td>Edinburgh</td>
522
						<td>51</td>
523
						<td>2008/11/13</td>
524
						<td>$183,000</td>
525
					</tr>
526
					<tr>
527
						<td>Michael Bruce</td>
528
						<td>Javascript Developer</td>
529
						<td>Singapore</td>
530
						<td>29</td>
531
						<td>2011/06/27</td>
532
						<td>$183,000</td>
533
					</tr>
534
					<tr>
535
						<td>Donna Snider</td>
536
						<td>Customer Support</td>
537
						<td>New York</td>
538
						<td>27</td>
539
						<td>2011/01/25</td>
540
						<td>$112,000</td>
541
					</tr>
542
				</tbody>
543
			</table>
544

    
545
			<ul class="tabs">
546
				<li class="active">Javascript</li>
547
				<li>HTML</li>
548
				<li>CSS</li>
549
				<li>Ajax</li>
550
				<li>Server-side script</li>
551
			</ul>
552

    
553
			<div class="tabs">
554
				<div class="js">
555
					<p>The Javascript shown below is used to initialise the table shown in this
556
					example:</p><code class="multiline brush: js;">$(document).ready(function() {
557
	var table = $('#example').DataTable();
558
	var tt = new $.fn.dataTable.TableTools( table );
559

    
560
	$( tt.fnContainer() ).insertBefore('div.dataTables_wrapper');
561
} );</code>
562

    
563
					<p>In addition to the above code, the following Javascript library files are loaded for use in this
564
					example:</p>
565

    
566
					<ul>
567
						<li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
568
						<li><a href=
569
						"../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
570
						<li><a href="../js/dataTables.tableTools.js">../js/dataTables.tableTools.js</a></li>
571
						<li><a href=
572
						"//cdn.datatables.net/plug-ins/505bef35b56/integration/bootstrap/3/dataTables.bootstrap.js">//cdn.datatables.net/plug-ins/505bef35b56/integration/bootstrap/3/dataTables.bootstrap.js</a></li>
573
					</ul>
574
				</div>
575

    
576
				<div class="table">
577
					<p>The HTML shown below is the raw HTML table element, before it has been enhanced by
578
					DataTables:</p>
579
				</div>
580

    
581
				<div class="css">
582
					<div>
583
						<p>This example uses a little bit of additional CSS beyond what is loaded from the library
584
						files (below), in order to correctly display the table. The additional CSS used is shown
585
						below:</p><code class="multiline brush: js;">body { font-size: 140%; }
586
	div.DTTT { margin-bottom: 0.5em; float: right; }
587
	div.dataTables_wrapper { clear: both; }</code>
588
					</div>
589

    
590
					<p>The following CSS library files are loaded for use in this example to provide the styling of the
591
					table:</p>
592

    
593
					<ul>
594
						<li><a href=
595
						"//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css</a></li>
596
						<li><a href=
597
						"//cdn.datatables.net/plug-ins/505bef35b56/integration/bootstrap/3/dataTables.bootstrap.css">//cdn.datatables.net/plug-ins/505bef35b56/integration/bootstrap/3/dataTables.bootstrap.css</a></li>
598
					</ul>
599
				</div>
600

    
601
				<div class="ajax">
602
					<p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data
603
					will update automatically as any additional data is loaded.</p>
604
				</div>
605

    
606
				<div class="php">
607
					<p>The script used to perform the server-side processing for this table is shown below. Please note
608
					that this is just an example script using PHP. Server-side processing scripts can be written in any
609
					language, using <a href="//datatables.net/manual/server-side">the protocol described in the
610
					DataTables documentation</a>.</p>
611
				</div>
612
			</div>
613
		</section>
614
	</div>
615

    
616
	<section>
617
		<div class="footer">
618
			<div class="gradient"></div>
619

    
620
			<div class="liner">
621
				<h2>Other examples</h2>
622

    
623
				<div class="toc">
624
					<div class="toc-group">
625
						<h3><a href="./index.html">Examples</a></h3>
626
						<ul class="toc active">
627
							<li><a href="./defaults.html">Defaults</a></li>
628
							<li><a href="./button_text.html">Custom button text</a></li>
629
							<li class="active"><a href="./bootstrap.html">Bootstrap styling</a></li>
630
							<li><a href="./multiple_tables.html">Multiple tables</a></li>
631
							<li><a href="./alter_buttons.html">Button arrangement</a></li>
632
							<li><a href="./multi_instance.html">Multiple toolbars</a></li>
633
							<li><a href="./collection.html">Button collections</a></li>
634
							<li><a href="./new_init.html">Initialisation with `new`</a></li>
635
							<li><a href="./select_os.html">Row selection - operating system style</a></li>
636
							<li><a href="./plug-in.html">Plug-in button types</a></li>
637
							<li><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
638
							<li><a href="./select_single.html">Row selection - single row select</a></li>
639
							<li><a href="./swf_path.html">Setting the SWF path</a></li>
640
							<li><a href="./pdf_message.html">PDF message</a></li>
641
							<li><a href="./simple.html">Basic initialisation</a></li>
642
							<li><a href="./select_multi.html">Row selection - multi-row select</a></li>
643
						</ul>
644
					</div>
645
				</div>
646

    
647
				<div class="epilogue">
648
					<p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
649
					information about its API properties and methods.<br>
650
					Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
651
					<a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
652
					DataTables.</p>
653

    
654
					<p class="copyright">DataTables designed and created by <a href=
655
					"http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2014<br>
656
					DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
657
				</div>
658
			</div>
659
		</div>
660
	</section>
661
</body>
662
</html>
(2-2/17)