ids()

Since: Editor 1.7.4

Get the ids of the rows being edited.
Please note - this property requires the Editor extension for DataTables.

Description

When working with events in Editor it can often be useful to reference the rows that are being edited in the DataTable - this method provides that ability by giving easy access to the ids of the rows being edited (typically a primary key value from the database) - as defined by the idSrc option (defaults to DT_RowId).

Optionally the method can add a hash in front of each id value for use with the rows() method, allowing node, data, etc selection from the DataTable.

When called while editing or deleting row(s), the values returned reflect the ids of those rows being acted upon. If called while creating a new row, the value return reflect the indexes of the new row(s) being created, starting from 0 (create() allows for multiple rows to be created).

Type

ids( [ includeHash ] )

Gets a list of the ids of the rows being acted upon (create, edit or delete). The ids are defined by the idSrc property.

Parameters:

Returns:

string[]:
An array that contains the ids of the rows being edited.

Example

Get data for the rows being edited from DataTables:

editor.on('initEdit', function () {
	var ids = editor.ids(true);
	var data = table.rows(ids).data();

	// Do something with `data`...
});

Related

The following options are directly related and may also be useful in your application development.