File: columns%28%29.data%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 (51 lines) | stat: -rw-r--r-- 1,790 bytes parent folder | download | duplicates (6)
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
<?xml version="1.0" encoding="UTF-8" ?>
<dt-api group="columns">
	<name>columns().data()</name>
	<summary>Get the data for the cells in the selected columns.</summary>
	<since>1.10</since>

	<type type="function">
		<signature>columns().data()</signature>
		<description>Obtain the data for the columns from the selector</description>
		<returns type="DataTables.Api">DataTables API instance with data for each cell in the selected columns in the result set. This is a 2D array with the top level array entries for each column matched by the `dt-api columns()` selector.</returns>
	</type>

	<description>
		This method is used to get the data used for the cells in the columns matched by the selector from DataTables.

		Please note that the order of the data in the returned array and which rows the data is obtained from (searched rows, visible rows etc) is controlled by the `dt-type selector-modifier` option of the `dt-api columns()` selector used to get the selected columns.
	</description>

	<example title="Get a list of the unique data, sorted, from a single column"><![CDATA[
var table = $('#example').DataTable();

$('#listData').html( 
	table
		.columns( 0 )
		.data()
		.eq( 0 )      // Reduce the 2D array into a 1D array of data
		.sort()       // Sort data alphabetically
		.unique()     // Reduce to unique values
		.join( '<br>' )
);
]]></example>

	<example title="Check if a value is in the data in the columns with a class of '.check'"><![CDATA[
var table = $('#example').DataTable();

var idx = table
	.columns( '.check' )
	.data()
	.eq( 0 ) // Reduce the 2D array into a 1D array of data
	.indexOf( 'Yes' );

if ( idx === -1 ) {
	alert( 'Yes not found' );
}
else {
	alert( 'Yes was found' );
}
]]></example>

	<related type="api">column().data()</related>
</dt-api>