order()

Since: Editor 1.2.2

Get / set the ordering of fields, as they are displayed in the form.
Please note - this property requires the Editor extension for DataTables.

Description

This method provides the ability to determine what fields are configured in the form, and also the ability to reorder the way in which the fields are displayed.

Note that all fields must be included when reordering, and no additional fields can be added here (use add() to add more fields and clear() to remove a field). If an incorrect number of fields is given, or if a field that doesn't exist is given, Editor will throw an error.

Types

order()

Get a list of the configured fields, in their display order

Returns:

array: List of the configured fields in their current display order

order( order [, ... ] )

Set the order of the fields in the form. This can be done in one of two ways (see below for an example of each form):

  • Pass in an array as the first argument with the fields listed in the desired order in that array.
  • Pass in each field name individually, as its own argument

Parameters:

Returns:

DataTable.Editor: Editor instance

Examples

Get field ordering:

var order = editor.order();

Set the field order:

var order = editor.order();
order.unshift(order.pop()); // move the last field into the first position
editor.order(order);

Set the field order as arguments:

editor.order('pupil', 'grade', 'dept', 'exam-board');