title()

Since: Editor 1.0

Get / set the title of the form.
Please note - this property requires the Editor extension for DataTables.

Description

The form title provides the end user very quick summary information about what data they are being asked for, so they know what action the form will perform (for example Create new user or Delete account, etc).

This method provides the ability to set the form title at any point. It can also be used to retrieve the current form title, potentially for manipulation before being reset.

Types

title()

Since: 1.3

Get the form title

Returns:

string: Current form title

title( title )

Since: 1.0

Set the form title

Parameters:

Returns:

DataTable.Editor: Editor instance

Examples

Create an edit display used the title, buttons and edit methods:

$('#myTable tbody').on('click', 'tr', function () {
	editor
		.title('Edit record')
		.buttons('Update')
		.edit(this);
});

Use information from the row to be edited in the form title:

$('#myTable tbody').on('click', 'tr', function () {
	editor
		.title('Edit record for: ' + table.data(this).name) // where `table` is the DataTable instance
		.buttons('Update')
		.edit(this);
});

Show a create form, with a timer for the duration that the form is open:

editor
	.title('Add new record - time on form: 0s')
	.buttons('Save')
	.create();

// Add an event to the editor to stop the timer when the display is removed
var runTimer = true;
var timer = 0;

var interval = setInterval(function () {
	editor.title('Add new record - time on form: ' + timer + 's');
	timer++;
}, 1000);

editor.one('close', function () {
	clearInterval(interval);
});