File: shift%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 (32 lines) | stat: -rw-r--r-- 1,511 bytes parent folder | download | duplicates (3)
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
<?xml version="1.0" encoding="UTF-8" ?>
<dt-api group="utility">
	<name>shift()</name>
	<summary>Remove the first item from an API instance's result set.</summary>
	<since>1.10</since>

	<type type="function">
		<signature>shift()</signature>
		<description>Remove the first item from an API instance's result set.</description>
		<returns type="*">Item removed form the result set (was previously the first item in the result set).</returns>
	</type>

	<description>
		Just as with Javascript arrays, since the DataTables API object is "array like", items can be removed from a result set using this method. *Shifting* a result, shifts the item off the start of the result set. The API instance's result set is reduced in length by 1 and the item that was removed is returned from the function call. `dt-api pop()` can be used to perform the same action, but at the end of the array, if required.

		This method is a proxy for the Javascript `Array.prototype.shift` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `shift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift).
	</description>

	<example title="Get the last item from a column."><![CDATA[
var table = $('#example').DataTable();

var data = table
	.column( 0 )
	.data();

var firstItem = data.shift();

alert( 'First item in the result set was: '+firstItem );

]]></example>

</dt-api>