File: drawCallback.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 (40 lines) | stat: -rw-r--r-- 1,432 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
<?xml version="1.0" encoding="UTF-8" ?>
<dt-option group="callback">
	<name>drawCallback</name>
	<summary>Function that is called every time DataTables performs a draw.</summary>
	<since>1.10</since>

	<type type="function">
		<signature>drawCallback( settings )</signature>
		<parameter type="DataTables.Settings" name="settings">
			DataTables settings object
		</parameter>
		<scope>HTML table element</scope>
	</type>

	<description>
		It can be useful to take an action on every draw event of the table - for example you might want to update an external control with the newly displayed data, or  with server-side processing is enabled you might want to assign events to the newly created elements. This callback is designed for exactly that purpose and will execute on every draw.
	</description>

	<example title="Notify whenever DataTables does a draw"><![CDATA[
$('#example').dataTable( {
	"drawCallback": function( settings ) {
		alert( 'DataTables has redrawn the table' );
	}
} );
]]></example>

	<example title="Use API method in the callback to get the data for the rows in the draw"><![CDATA[
$('#example').dataTable( {
	"drawCallback": function( settings ) {
		var api = this.api();

		// Output the data for the visible rows to the browser's console
		console.log( api.rows( {page:'current'} ).data() );
	}
} );
]]></example>

	<related type="api">draw()</related>
	<related type="event">draw</related>
</dt-option>