fields.type

Since: Editor 1.0

Field input type.
Please note - this property requires the Editor extension for DataTables.

Description

The type option is used to tell Editor what form control type you wish to present to the end user for a particular field. For example the select type can be used to display select lists, and radio to display a collection of input[type=checkbox] input options.

Selecting the correct input type for your field can have a dramatic impact upon the usability of your form. For example, a simple binary field where a user can select between two values should be presented as a radio input, select list or a checkbox. A text input field allowing free-form text input would not be appropriate!

Each field type can optionally provide other options that can be configured through the fields objects. They can also provide additional API methods, as appropriate for that field type. Please refer to the documentation for each field type for full information about their features and configuration options.

Editor has a number of field types built in which are ready to use. Additional field types can also be added as plug-ins. For information on how to create field type plug-ins, please refer to the Editor development documentation.

Type

This option can be given in the following type(s):

Default

  • Value: text

The default field type is a simple text input control.

Example

Create a date type input field:

var editor = new DataTable.Editor({
	ajax: 'php/staff.php',
	table: '#myTable',
	fields: [
		{
			label: 'Update time:',
			name: 'update',
			type: 'date'
		}
	]
});