row.create()
Create a new row.
Please note - this property requires the Editor extension for DataTables.
Description
This method can be used to create a new record using the Editor main form. It is essentially a proxy for the create()
method, exposed through the DataTables API object.
The Editor instance used by this method is the last Editor instance create that refers to this table when the table was constructed. This consideration is only important when using multiple Editor instances!
Please note that this method only exposes one small part of Editor through the DataTables API. Editor has its own extensive API which provides complete control over the form.
Type
function row.create( options )
- Description:
Display an Editor form which the end user can utilise to enter data for a new row to be created in a DataTable with.
- Parameters:
Name Type Optional 1 options
No Form configuration options, including the ability to set the title, buttons and behaviour of the form.
- Returns:
The original API instance, unmodified, is returned to allow chaining.
Examples
Display the Editor form to create a new row with default options:
var myTable = new DataTable('#myTable');
myTable.row.create();
Explicitly set the form title:
var myTable = new DataTable('#myTable');
myTable.row.create({
title: 'Create new row'
});
Display the create form with a cancel button:
var myTable = new DataTable('#myTable');
myTable.row.create({
buttons: [
{
label: 'Cancel',
fn: function () {
this.close();
}
},
'Create'
]
});
Related
The following options are directly related and may also be useful in your application development.