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 - Row selection - multi-row select</title>
9
	<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
10
	<link rel="stylesheet" type="text/css" href="../css/dataTables.tableTools.css">
11
	<link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
12
	<link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
13
	<style type="text/css" class="init">
14

    
15
	</style>
16
	<script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
17
	<script type="text/javascript" language="javascript" src="../../../media/js/jquery.dataTables.js"></script>
18
	<script type="text/javascript" language="javascript" src="../js/dataTables.tableTools.js"></script>
19
	<script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
20
	<script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
21
	<script type="text/javascript" language="javascript" class="init">
22

    
23

    
24

    
25
$(document).ready(function() {
26
	$('#example').DataTable( {
27
		dom: 'T<"clear">lfrtip',
28
		tableTools: {
29
			"sRowSelect": "multi",
30
			"aButtons": [ "select_all", "select_none" ]
31
		}
32
	} );
33
} );
34

    
35

    
36
	</script>
37
</head>
38

    
39
<body class="dt-example">
40
	<div class="container">
41
		<section>
42
			<h1>TableTools example <span>Row selection - multi-row select</span></h1>
43

    
44
			<div class="info">
45
				<p>As well as providing a button toolbar, TableTools provides everything needed to have selectable rows
46
				in the table. TableTools has four row selection modes of operation:</p>
47

    
48
				<ul class="markdown">
49
					<li><code>none</code> - Default, where no user row selection options are available</li>
50
					<li><code>single</code> - A single row can be selected</li>
51
					<li><code>multi</code> - Multiple rows can be selected simply by clicking on the rows</li>
52
					<li><code>os</code> - Operating System like selection where you can use the shift and ctrl / cmd
53
					keys on your keyboard to add / remove rows from the selection.</li>
54
				</ul>
55

    
56
				<p>This example shows the <code>multi</code> select option. There are also a number of <a href=
57
				"http://datatables.net/extras/tabletools/buttons">pre-defined buttons</a> to provide functions such as
58
				select-all and select-none, as shown in this example.</p>
59
			</div>
60

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

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

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

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

    
552
			<div class="tabs">
553
				<div class="js">
554
					<p>The Javascript shown below is used to initialise the table shown in this
555
					example:</p><code class="multiline brush: js;">$(document).ready(function() {
556
	$('#example').DataTable( {
557
		dom: 'T&lt;&quot;clear&quot;&gt;lfrtip',
558
		tableTools: {
559
			&quot;sRowSelect&quot;: &quot;multi&quot;,
560
			&quot;aButtons&quot;: [ &quot;select_all&quot;, &quot;select_none&quot; ]
561
		}
562
	} );
563
} );</code>
564

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

    
568
					<ul>
569
						<li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
570
						<li><a href=
571
						"../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
572
						<li><a href="../js/dataTables.tableTools.js">../js/dataTables.tableTools.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;"></code>
586
					</div>
587

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

    
591
					<ul>
592
						<li><a href=
593
						"../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
594
						<li><a href="../css/dataTables.tableTools.css">../css/dataTables.tableTools.css</a></li>
595
					</ul>
596
				</div>
597

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

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

    
613
	<section>
614
		<div class="footer">
615
			<div class="gradient"></div>
616

    
617
			<div class="liner">
618
				<h2>Other examples</h2>
619

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

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

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