Subversion-Projekte lars-tiefland.faltradxxs.de

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 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 - row selector on specific cells</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=
12
	"//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css">
13
	<link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
14
	<link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
15
	<style type="text/css" class="init">
16
 
17
	tr td:first-child {
18
		text-align: center;
19
	}
20
 
21
	tr td:first-child:before {
22
		content: "\f096"; /* fa-square-o */
23
		font-family: FontAwesome;
24
	}
25
 
26
	tr.selected td:first-child:before {
27
		content: "\f046"; /* fa-check-square-o */
28
	}
29
 
30
	</style>
31
	<script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
32
	<script type="text/javascript" language="javascript" src="../../../media/js/jquery.dataTables.js"></script>
33
	<script type="text/javascript" language="javascript" src="../js/dataTables.tableTools.js"></script>
34
	<script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
35
	<script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
36
	<script type="text/javascript" language="javascript" class="init">
37
 
38
 
39
 
40
$(document).ready(function() {
41
	$('#example').DataTable( {
42
		ajax: "../../../examples/ajax/data/objects.txt",
43
		columns: [
44
			{ data: null, defaultContent: '', orderable: false },
45
			{ data: 'name' },
46
			{ data: 'position' },
47
			{ data: 'office' },
48
			{ data: 'extn' },
49
			{ data: 'start_date' },
50
			{ data: 'salary' }
51
		],
52
		order: [ 1, 'asc' ],
53
		dom: 'T<"clear">lfrtip',
54
		tableTools: {
55
			sRowSelect:   'os',
56
			sRowSelector: 'td:first-child',
57
			aButtons:     [ 'select_all', 'select_none' ]
58
		}
59
	} );
60
} );
61
 
62
 
63
	</script>
64
</head>
65
 
66
<body class="dt-example">
67
	<div class="container">
68
		<section>
69
			<h1>TableTools example <span>Row selection - row selector on specific cells</span></h1>
70
 
71
			<div class="info">
72
				<p>By default, TableTools' row selector option will register a row selection click on any part of the
73
				row. Although this is often desirable, you might wish at times to limit the row selection to just a
74
				single column, or other elements in the row. This might be useful, for example, with <a href=
75
				"//editor.datatables.net">Editor's</a> inline editing, so you don't select the row on click of a cell
76
				that is to be edited.</p>
77
 
78
				<p>The <code>sRowSelector</code> method provides this ability, allowing a custom jQuery selector to be
79
				passed in. TableTools will use the parent row of any element that is selected by the end user.</p>
80
 
81
				<p>In this case, the row selector is attached to the cells in the first column of the table, and
82
				<a href="http://fortawesome.github.io/Font-Awesome">Font Awesome</a> is used to display a checkbox
83
				indicating the selection state of the row, in addition to the row background colouring.</p>
84
			</div>
85
 
86
			<table id="example" class="display" cellspacing="0" width="100%">
87
				<thead>
88
					<tr>
89
						<th>
90
 
91
						<th>Name</th>
92
						<th>Position</th>
93
						<th>Office</th>
94
						<th>Age</th>
95
						<th>Start date</th>
96
						<th>Salary</th>
97
					</tr>
98
				</thead>
99
			</table>
100
 
101
			<ul class="tabs">
102
				<li class="active">Javascript</li>
103
				<li>HTML</li>
104
				<li>CSS</li>
105
				<li>Ajax</li>
106
				<li>Server-side script</li>
107
			</ul>
108
 
109
			<div class="tabs">
110
				<div class="js">
111
					<p>The Javascript shown below is used to initialise the table shown in this
112
					example:</p><code class="multiline brush: js;">$(document).ready(function() {
113
	$('#example').DataTable( {
114
		ajax: &quot;../../../examples/ajax/data/objects.txt&quot;,
115
		columns: [
116
			{ data: null, defaultContent: '', orderable: false },
117
			{ data: 'name' },
118
			{ data: 'position' },
119
			{ data: 'office' },
120
			{ data: 'extn' },
121
			{ data: 'start_date' },
122
			{ data: 'salary' }
123
		],
124
		order: [ 1, 'asc' ],
125
		dom: 'T&lt;&quot;clear&quot;&gt;lfrtip',
126
		tableTools: {
127
			sRowSelect:   'os',
128
			sRowSelector: 'td:first-child',
129
			aButtons:     [ 'select_all', 'select_none' ]
130
		}
131
	} );
132
} );</code>
133
 
134
					<p>In addition to the above code, the following Javascript library files are loaded for use in this
135
					example:</p>
136
 
137
					<ul>
138
						<li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
139
						<li><a href=
140
						"../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
141
						<li><a href="../js/dataTables.tableTools.js">../js/dataTables.tableTools.js</a></li>
142
					</ul>
143
				</div>
144
 
145
				<div class="table">
146
					<p>The HTML shown below is the raw HTML table element, before it has been enhanced by
147
					DataTables:</p>
148
				</div>
149
 
150
				<div class="css">
151
					<div>
152
						<p>This example uses a little bit of additional CSS beyond what is loaded from the library
153
						files (below), in order to correctly display the table. The additional CSS used is shown
154
						below:</p><code class="multiline brush: js;">tr td:first-child {
155
		text-align: center;
156
	}
157
 
158
	tr td:first-child:before {
159
		content: &quot;\f096&quot;; /* fa-square-o */
160
		font-family: FontAwesome;
161
	}
162
 
163
	tr.selected td:first-child:before {
164
		content: &quot;\f046&quot;; /* fa-check-square-o */
165
	}</code>
166
					</div>
167
 
168
					<p>The following CSS library files are loaded for use in this example to provide the styling of the
169
					table:</p>
170
 
171
					<ul>
172
						<li><a href=
173
						"../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
174
						<li><a href="../css/dataTables.tableTools.css">../css/dataTables.tableTools.css</a></li>
175
						<li><a href=
176
						"//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css">//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css</a></li>
177
					</ul>
178
				</div>
179
 
180
				<div class="ajax">
181
					<p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data
182
					will update automatically as any additional data is loaded.</p>
183
				</div>
184
 
185
				<div class="php">
186
					<p>The script used to perform the server-side processing for this table is shown below. Please note
187
					that this is just an example script using PHP. Server-side processing scripts can be written in any
188
					language, using <a href="//datatables.net/manual/server-side">the protocol described in the
189
					DataTables documentation</a>.</p>
190
				</div>
191
			</div>
192
		</section>
193
	</div>
194
 
195
	<section>
196
		<div class="footer">
197
			<div class="gradient"></div>
198
 
199
			<div class="liner">
200
				<h2>Other examples</h2>
201
 
202
				<div class="toc">
203
					<div class="toc-group">
204
						<h3><a href="./index.html">Examples</a></h3>
205
						<ul class="toc active">
206
							<li><a href="./simple.html">Basic initialisation</a></li>
207
							<li><a href="./plug-in.html">Plug-in button types</a></li>
208
							<li><a href="./bootstrap.html">Bootstrap styling</a></li>
209
							<li><a href="./swf_path.html">Setting the SWF path</a></li>
210
							<li><a href="./new_init.html">Initialisation with `new`</a></li>
211
							<li><a href="./defaults.html">Defaults</a></li>
212
							<li><a href="./select_single.html">Row selection - single row select</a></li>
213
							<li><a href="./select_multi.html">Row selection - multi-row select</a></li>
214
							<li><a href="./select_os.html">Row selection - operating system style</a></li>
215
							<li class="active"><a href="./select_column.html">Row selection - row selector on specific
216
							cells</a></li>
217
							<li><a href="./multiple_tables.html">Multiple tables</a></li>
218
							<li><a href="./multi_instance.html">Multiple toolbars</a></li>
219
							<li><a href="./collection.html">Button collections</a></li>
220
							<li><a href="./button_text.html">Custom button text</a></li>
221
							<li><a href="./alter_buttons.html">Button arrangement</a></li>
222
							<li><a href="./ajax.html">Ajax loaded data</a></li>
223
							<li><a href="./pdf_message.html">PDF message</a></li>
224
							<li><a href="./jqueryui.html">jQuery UI styling</a></li>
225
						</ul>
226
					</div>
227
				</div>
228
 
229
				<div class="epilogue">
230
					<p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
231
					information about its API properties and methods.<br>
232
					Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
233
					<a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
234
					DataTables.</p>
235
 
236
					<p class="copyright">DataTables designed and created by <a href=
237
					"http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2014<br>
238
					DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
239
				</div>
240
			</div>
241
		</div>
242
	</section>
243
</body>
244
</html>