DefaultValueListener

DefaultValueListener

Represents an event listener for calculating default values. DefaultValueListener is one of the default listeners which are being registered for all data models.

A data field may have a default value attribute. An instance of FunctionContext class will calculate this value by evaluating the expression provided. The default value listener will process all fields of an inserted data object which have a default value expression and does not have a defined value.


 {
        "name": "createdBy",
        "title": "Created By",
        "type": "User",
        "value":"javascript:return this.user();",
        "readonly":true
    }
 

Note: FunctionContext class may be extended in order to allow applications to perform value calculations.

Constructor

new DefaultValueListener()

Source:

Methods

beforeSave(e, callback)

Occurs before creating or updating a data object and calculates default values with the defined value expression.
Parameters:
Name Type Description
e DataEventArgs | * An object that represents the event arguments passed to this operation.
callback function A callback function that should be called at the end of this operation. The first argument may be an error if any occured.
Source: