field().disable()
Disable a field, disallowing user input.
Please note - this property requires the Editor extension for DataTables.
The full Editor reference documentation is available to registered users of Editor - the information shown below is a summary only. If you already have an Editor license please sign-in, alternatively an Editor license can be purchased on this site, or sign up for the free trial.
Description
It can at times be useful to disable a field, preventing the user from modifying the field's current value. This method provides exactly that ability.
While the field is disabled, it can still have its value modified by field().set()
, field().val()
, etc.
This is the inverse of the field().enable()
method, which will enable a previously disabled field.
Note that the disable()
method also provides the ability to disable a field, and extends that capability to being able to disable multiple fields in a single call. As such, these two methods can often be used interchangeably. The key difference is in the return value - this method will return a DataTables.Editor.Field
instance, while the disable()
method returns a DataTables.Editor
instance. This can effect how you chain methods if you are using the returned value for chaining.