File: flatten%28%29.xml

package info (click to toggle)
datatables.js 1.11.5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 22,848 kB
  • sloc: javascript: 65,075; xml: 10,712; php: 4,741; sh: 544; makefile: 18
file content (29 lines) | stat: -rw-r--r-- 1,183 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
<?xml version="1.0" encoding="UTF-8" ?>
<dt-api group="utility">
	<name>flatten()</name>
	<summary>Flatten a 2D array structured API instance to a 1D array structure.</summary>
	<since>1.10</since>

	<type type="function">
		<signature>flatten()</signature>
		<description>Reduce a 2D array structured API instance to a 1D array structure.</description>
		<returns type="DataTables.Api">New API instance with the 2D array values reduced to a 1D array.</returns>
	</type>

	<description>
		This method will reduce a 2D array structure to a simple 1D structure, which can be particularly useful when working with the plural methods such as `dt-api rows()` and `dt-api columns()` which can return 2D structures data (for example in the columns data, each column has its own array of information).

		This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type.
	</description>

	<example title="Get the data from two columns in a single array"><![CDATA[
var table = $('#example').DataTable();

var data = table
	.columns( [0, 1] )
	.data()
	.flatten();

]]></example>

</dt-api>