{hero}

fields.compare

Since: Editor 1.7

Define a custom comparison function for the field's data.
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

Editor has the ability to determine if a field's data should be submitted to the server or not based on the submit option of the form-options object for the form. This can be useful to restrict submission of data to only those items which have changed value.

This property provides the ability to tell Editor how to determine if a field has changed value or not. By default Editor will use a loose type check that will descend into nested objects, checking that all properties are present. You may wish to alter this to perform strict type checking or implement a different form of deep object comparison if you are using objects.

Note Editor uses loose type checking by default as the values from the field input elements are read from the document, and thus will be strings. Please keep this in mind if you are implementing your own comparison function.