enable()
Enable one or more fields, allowing user input.
Please note - this property requires the Editor extension for DataTables.
Description
It can at times be useful to enable and disable a particular field, or set of fields, allowing and preventing the user from modifying the field's value. This method provides the ability to enable a field control for user input.
This is the inverse of the disable() method which will disable a currently enabled field.
Note that the field().enable() method introduced in Editor 1.3 provides the same functionality as this method. Both forms will continue to be supported in future versions of Editor, and they can often be used interchangeably. The key difference is in the return value - this method will return a DataTable.Editor instance, while the field().enable() method returns a DataTable.Editor.Field instance. This can effect how you chain methods if you are using the returned value for chaining.
Type
enable( [ fieldName ] )
Enable one or more fields, preventing the end user from altering the field's value.
Parameters:
| Name | Type | Optional | |
|---|---|---|---|
| 1 | fieldName | Yes | |
Field names to be enabled. Multiple fields can be enabled by giving this parameter as an array with a field name in each element. This parameter is optional. If not given, the | |||
Returns:
DataTable.Editor: Editor instance
Examples
Show a 'create' record form, but with a particular field enabled (it might have previously been disabled for example):
editor
.enable('account_type')
.buttons('Save')
.title('Save')
.create();Enable multiple fields by using an array of field names:
editor.enable(['account_type', 'access_level']);Enable all fields in the form:
editor.enable();