formOptions.main
Since: Editor 1.3
Form configuration options for the main editing display.
Please note - this property requires the Editor extension for DataTables.
Description
This option provides the ability of setting default styling and behavioural options for the main editing form display (create(), edit() and remove()). Options can also be set when calling the API methods, which will override the options defined by this parameter.
For full details of the form options available, please refer to the form-options object's documentation.
Type
This option can be given in the following type(s):
Default
The default configuration for this object is:
{
buttons: true,
focus: 0,
message: true,
onBackground: 'blur',
onBlur: 'close',
onComplete: 'close',
onEsc: 'close',
onFieldError: 'focus',
onReturn: 'submit',
refresh: false,
submit: 'all',
title: false,
drawType: false,
scope: 'row'
}
Examples
Set options the inline editor.:
const editor = new DataTable.Editor({
ajax: '/api/staff',
table: '#myTable',
formOptions: {
main: {
onReturn: false,
onBackground: false
}
}
});Submit the values of the changed fields only:
const editor = new DataTable.Editor({
ajax: '/api/staff',
table: '#myTable',
formOptions: {
main: {
submit: 'changed'
}
}
});Refresh data from the server when editing is triggered:
const editor = new DataTable.Editor({
ajax: '/api/staff',
table: '#myTable',
formOptions: {
main: {
refresh: true
}
}
});