add()
Add a new field to the form.
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
Fields in an Editor form can be dynamically added and removed from the form at any point, using this method and the clear()
method.
By default, fields added using this method are automatically appended to the end of the form. As of Editor 1.5.6 you can optionally use the second parameter to determine where in the form's field order the new field should be inserted, or, for older versions, use the order()
method to change the field order after the new field has been added.
You may also wish to use hide()
if you do not wish the field to be visible immediately - call hide()
with the second parameter set to false
to disable animation.
Fields are typically set up during instance initialisation using the fields
configuration option (which calls this API method internally) but this option provides the flexibility to modify the fields in the form - for example you might wish to ask for an extra input if a particular option is selected in a select
list.