FlexberryEnumTransform Class
Base transform class that implements an enumeration type. During serialization\deserialization it converts values to captions and vise versa.
Methods
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
});
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