fields.name
Unique name of the field - sent to the server on form submission.
Please note - this property requires the Editor extension for DataTables.
Description
When a form is submitted to the server for processing and storage, the server needs to be able to uniquely identify each field, and the value that the field will then take. This option provides that ability to set the field name that is used to submit to the server. It is also typically the parameter name that is used as the data source for the field from the source data for the row / form, although fields.data does provide the ability to alter that.
This is the only required parameter for a field (although you will typically want to use fields.label as well to set a user readable label) and Editor will throw an error if it is not provided. It must also be unique in the Editor instance (i.e. two fields cannot share the same name). Again, if this requirement is not met, Editor will throw an error.
As well as having an effect on fields.data, this option can also effect fields.id. If no values are provided for those options, Editor will assign values for them automatically based on this parameter.
Type
This option can be given in the following type(s):
Examples
Simple set of the field name:
var editor = new DataTable.Editor({
ajax: 'php/staff.php',
table: '#myTable',
fields: [
{
label: 'First name:',
name: 'first_name'
}
]
});Using Javascript dotted object notation in the name. Note this is used literally for the field name, but fields.data will use this to read nested data.:
var editor = new DataTable.Editor({
ajax: 'php/staff.php',
table: '#myTable',
fields: [
{
label: 'First name:',
name: 'users.first_name'
}
]
});