File: row%28%29.remove%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 (47 lines) | stat: -rw-r--r-- 1,926 bytes parent folder | download | duplicates (4)
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
<?xml version="1.0" encoding="UTF-8" ?>
<dt-api group="rows">
	<name>row().remove()</name>
	<summary>Delete the selected row from the DataTable.</summary>
	<since>1.10</since>

	<type type="function">
		<signature>row().remove()</signature>
		<description>Delete the selected row.</description>
		<returns type="DataTables.Api">DataTables API instance with removed row reference in the result set</returns>
	</type>

	<description>
		This method (and its plural counterpart, `dt-api rows().remove()`) will remove the selected row from the DataTable completely, deleting the allocated memory for data and node from the browser.

		Please be aware that this method removes the data from the table internally but that action won't be visually shown until the  `dt-api draw()` method is called to update the display. This can be called simply as a chained method of the `dt-api row().remove()` method's returned object - for example `table.row().remove().draw();`. This method is used to reduce the number of draws required if multiple rows are being deleted for optimisation.
	</description>

	<example title="Delete a row when a delete icon is clicked upon in the row"><![CDATA[
var table = $('#example').DataTable();

$('#example tbody').on( 'click', 'img.icon-delete', function () {
	table
		.row( $(this).parents('tr') )
		.remove()
		.draw();
} );
]]></example>

	<example title="Transfer a row from one table to another (note that this is for DOM sourced tables, use `dt-api row().data()` for other data sources)"><![CDATA[
var table1 = $('#example1').DataTable();
var table2 = $('#example2').DataTable();

$('#example tbody').on( 'click', 'img.icon-transfer', function () {
	var row = table1.row( $(this).parents('tr') );
	var rowNode = row.node();
	row.remove();

	table2
		.row.add( rowNode )
		.draw();
} );
]]></example>

	<related type="api">rows().remove()</related>
	<related type="api">clear()</related>
</dt-api>