File: infoCallback.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 (61 lines) | stat: -rw-r--r-- 2,251 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?xml version="1.0" encoding="UTF-8" ?>
<dt-option group="callback">
	<name>infoCallback</name>
	<summary>Table summary information display callback.</summary>
	<since>1.10</since>

	<type type="function">
		<signature>infoCallback( settings, start, end, max, total, pre )</signature>
		<parameter type="DataTables.Settings" name="settings">
			DataTables settings object
		</parameter>
		<parameter type="integer" name="start">
			Starting position in data for the draw
		</parameter>
		<parameter type="integer" name="end">
			End position in data for the draw
		</parameter>
		<parameter type="integer" name="max">
			Total number of rows in the table (regardless of filtering)
		</parameter>
		<parameter type="integer" name="total">
			Total number of rows in the data set, after filtering
		</parameter>
		<parameter type="string" name="pre">
			The string that DataTables has formatted using its own rules
		</parameter>
		<returns type="string">
			The string to be displayed in the information element.
		</returns>
		<scope>HTML table element</scope>
	</type>

	<description>
		The information element can be used to convey information about the current state of the table. Although the internationalisation options presented by DataTables are quite capable of dealing with most customisations, there may be times where you wish to customise the string further. This callback allows you to do exactly that.

		Please note that if the `dt-init info` option id disable in the initialisation, this callback function is not fired.
	</description>

	<example title="Show start to end indexes in the information element"><![CDATA[
$('#example').dataTable( {
  "infoCallback": function( settings, start, end, max, total, pre ) {
    return start +" to "+ end;
  }
} );
]]></example>

	<example title="Use the API in the callback to show page count"><![CDATA[
$('#example').dataTable( {
  "infoCallback": function( settings, start, end, max, total, pre ) {
    var api = this.api();
    var pageInfo = api.page.info();

    return 'Page '+ (pageInfo.page+1) +' of '+ pageInfo.pages;
  }
} );
]]></example>

	<related type="option">info</related>
	<related type="option">language.info</related>
	<related type="api">page.info()</related>
</dt-option>