Show:

Base transform class that implements an enumeration type. During serialization\deserialization it converts values to captions and vise versa.

Item Index

Properties

Methods

deserialize

(
  • serialized
)
String

Returns deserialized enumeration field. Returns null or undefined if serialized has one of these values.

Parameters:

Returns:

String:

Deserialized enumeration field

serialize

(
  • deserialized
)
String | Number

Returns serialized enumeration field. Returns null or undefined if deserialized has one of these values.

Parameters:

  • deserialized String

    Deserialized enumeration field

Returns:

String | Number:

Serialized enumeration field

Properties

captions

Array

Array that contains all values of enum properties.

enum

Object

Object that contains enum values and corresponding captions. Must be overridden in inherited classes.

Should be defined in app/enums/.

Example:

// app/enums/order-status.js
                    import { createEnum } from 'ember-flexberry/utils/enum-functions';
                    
                    export default createEnum({
                      Paid: 'Paid',
                      InProcess: 'In process',
                      Sent: 'Sent',
                      Arrived: 'Arrived',
                      NotArrived: 'Not arrived',
                      Unknown: 'Unknown'
                    });
                    
                    // app/transforms/order-status
                    import FlexberryEnum from 'ember-flexberry/transforms/flexberry-enum';
                    import OrderStatus from '../enums/order-status';
                    
                    export default FlexberryEnum.extend({
                      enum: OrderStatus
                    });
                    

inverse

Object

Object with inversed enum, value from enum property will be is property here.

isEnum

Boolean static

Flag: indicates whether class represents enumeration. It is useful in cases when we need to determine that the model attribute type is an enumeration.

Default: true

sourceType

String

Source type name from the backend.

Default: null