fields.data
Data property from the data source object to use as the data for this field.
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
This option provides the field with the information that it needs in order to know which data property from the source object should be used as the value of this field. For example, consider the data structure:
{
"name": "Tiger Nixon",
"position": "System Architect",
"salary": "$320,800",
"start_date": "2011/04/25",
"office": "Edinburgh",
"extn": "5421"
}
To configure a field to use the salary
field you would set this option to salary
. Likewise, to use the office
use office
.
By default, if not given in the initialisation of the field, it is automatically set to match the value of the fields.name
property. This is by far the most common use case - as it helps keep things simple, but it is possible with this option to perform complex data transformations if needed.
fields.data
as the same abilities as the DataTables columns.data
property, in that it can read deeply nested data using dotted Javascript object notation and can even be given as a function. Please refer to the columns.data
documentation for the full range of options available.
Backwards compatibility note
In previous versions of Editor (1.2-) this was called dataProp
. It has been renamed for simplification and harmonisation with DataTables (columns.data
). The old name can still be used for backwards compatibility, but the new form is preferred.