File: cell%28%29.invalidate%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 (50 lines) | stat: -rw-r--r-- 2,994 bytes parent folder | download | duplicates (2)
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
<?xml version="1.0" encoding="UTF-8" ?>
<dt-api group="cells">
	<name>cell().invalidate()</name>
	<summary>Invalidate the data held in DataTables for the selected cells</summary>
	<since>1.10</since>

	<type type="function">
		<signature>cell().invalidate( [ source ] )</signature>
		<description>Invalidate information in the selected cell</description>
		<parameter type="string" name="source" default="auto">
			Data source to read the new data from.

			By default, DataTables will automatically read the new data for the row from the same source as it was originally read (i.e. DOM sourced or Javascript sourced) but this parameter can be used to override that and tell DataTables specifically which should be used to read in the new data. This might be useful if you are Ajax loading data but use the DOM to modify the contents of cells.

			This property can take the values:

			* `-string auto` - use original data source
			* `-string data` - use the Javascript data structure
			* `-string dom` - use the data currently held in the DOM
		</parameter>
		<returns type="DataTables.Api">DataTables API instance with selected cell reference in the result set</returns>
	</type>

	<description>
		DataTables holds cached information about the contents of each cell in the table to increase performance of table operations such as ordering and searching. If you were to modify the contents of a cell (for DOM data source tables) or the array / object values (for Ajax / JS source tables) DataTables wouldn't know that this has happened. This method can be used to tell DataTables to re-read the information from the data source for the row (be it from the DOM or objects / arrays - whatever the original data source was).

		This provides an alternative to using `dt-api cell().data()` and `dt-api row().data()` when changing cell values. Typically the `data` methods are preferred over the invalidation methods, as they use less code, but where the invalidation methods really shine is when the data source for the table are external objects which can be updated using that objects own methods.

		Prior to <span class="since">DataTables 1.10.4</span> this method actually invalidated the whole row. As of <span class="since">1.10.4</span> only the cell in question is invalidated.
	</description>

	<example title="Increment a cell's value and then invalidate and redraw the table"><![CDATA[
var table = $('#example').DataTable();

$('#example tbody').on( 'click', 'td', function () {
	this.innerHTML = parseInt( this.innerHTML ) + 1;
	table.cell( this ).invalidate().draw();
} );

]]></example>

	<related type="api">cells().cache()</related>
	<related type="api">cells().data()</related>
	<related type="api">cells().render()</related>
	<related type="api">cells().invalidate()</related>
	<related type="api">cell().cache()</related>
	<related type="api">cell().data()</related>
	<related type="api">cell().render()</related>
	<related type="api">row().invalidate()</related>
</dt-api>