File: row%28%29.index%28%29.xml

package info (click to toggle)
datatables.js 1.10.13%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,232 kB
  • ctags: 1,329
  • sloc: xml: 10,249; php: 4,387; sh: 492; makefile: 21
file content (43 lines) | stat: -rw-r--r-- 1,519 bytes parent folder | download | duplicates (2)
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
<?xml version="1.0" encoding="UTF-8" ?>
<dt-api group="rows">
	<name>row().index()</name>
	<summary>Get the row index of the selected row.</summary>
	<since>1.10</since>

	<type type="function">
		<signature>row().index()</signature>
		<description>Get the row index of the row column.</description>
		<returns type="integer">Row index</returns>
	</type>

	<description>
		DataTables stores the data for rows and columns in internally indexes which it can utilise for fast operation of ordering, searching etc. It can be useful at times to know what these indexes are, as they can be used for efficient selectors in the `dt-api row()`, `dt-api column()` and other API methods which use selectors.

		This method is used to retrieve the indexes of the selected rows which can then be used as part of a selector to update data.
	</description>

	<example title="Show an alert with the row index that was clicked upon"><![CDATA[
var table = $('#example').DataTable();

$('#example tbody').on( 'click', 'tr', function () {
	alert( 'Row index: '+table.row( this ).index() );
} );
]]></example>

	<example title="Use the selected row as part of a `dt-api cells()` selector."><![CDATA[
var table = $('#example').DataTable();

$('#example tbody').on( 'click', 'tr', function () {
	var idx = table
		.row( this )
		.index();

	table
		.cell( idx, 0 ) // note that you could actually pass in 'this' as the row selector!
		.data( 'Updated' )
		.draw();
} );
]]></example>

	<related type="api">rows().indexes()</related>
</dt-api>