{hero}

mode()

Since: Editor 1.4.1

Get / set the mode of operation the Editor form is currently in.
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 , alternatively an Editor license can be purchased on this site, or sign up for the free trial.

Description

This method can be used to programmatically determine which mode of operation the Editor form is currently operating in, and as of 1.7 also the set the mode of operation.

The mode is set automatically when create(), edit(), bubble(), inline() and remove() are called. While the Editor instance is in a particular mode, it can be submitted.

This method can be particularly useful in event handlers such as open to determine which mode of operation is being used, and thus trigger certain actions (showing / hiding fields for example).

As a setter, this method can be used to change the mode of operation. For example you might start a form in edit mode, and then change it to create. This effectively will create a duplicate row. Note that certain changes are pointless - specifically:

  • create to edit
  • create to remove

These mode changes should not be used. As of v1.9 attempting to use these transforms will result in an error being thrown.