DataField
data field model object
Signature:
export interface DataField
Remarks
Used in field-related methods of DataProvider.
Example
// model
let fields = ds.getFields();
ds.setFields(fields);
Events
Property | Type | Description |
---|---|---|
valueCallback | FieldValueCallback | If it is a calculated field, the callback to be calculated by specifying a formula |
Properties
Property | Type | Description |
---|---|---|
amText | string | AM display text |
baseField | string | criteria field |
baseYear | number | If the year value is less than 100, base year |
booleanFormat | string | When the value is of type Boolean, Format |
calculated | boolean | Whether it is a calculated field |
dataType | ValueType | data type |
datetimeFormat | string | When the value is in date format, Format |
defaultValue | any | Default data value for field |
fieldName | string | field name |
header | string | Group Header Title |
index | number | index of field |
length | number | data length |
maximum | number | limit value of maximum range |
minimum | number | Minimum range limit |
nullValue | any | Data to be replaced when data is null |
orgFieldName | string | Field name at the time of designation |
pmText | string | PM display text |
required | boolean | (ALPHA) Data required |
set | any[] | Fieldset |
subType | ValueType | Directive for using basic data types to a limited extent |
subTypeEnabled | boolean | Indicator for using a data type in a limited range Availability |
updatable | boolean | Whether field values can be modified |
valueExpression | string | Formula to be used if it is a calculated field |
Events Desc
valueCallback
If it is a calculated field, the callback to be calculated by specifying a formula
Type
- FieldValueCallback
Remarks:
References to other calculated fields in formulas are not allowed.
Example:
dataField.valueCallback = function (provider, dataRow, fieldName, fieldNames, values) {
let quantity = values[fieldNames.indexOf("Quantity")];
let unitprice = values[fieldNames.indexOf("UnitPrice")];
if (isNaN(quantity) || isNaN(unitprice))
return undefined;
else
return quantity >= 1000 ? Math.round(quantity * unitprice * 0.95) : quantity * unitprice;
}
Properties Desc
amText
AM display text
Type
- string
baseField
criteria field
Type
- string
Remarks:
When reading, it is output in uppercase letters.
When accessed and set as a property, it is saved in uppercase letters.
Used during verification.
baseYear
Base year if year value is less than 100
Type
- number
booleanFormat
Formatting when the value is of type Boolean
Type
- string
Remarks:
If this value is specified, it is used as a conversion format when outputting the value of a boolean field.
The value set in DataOutputOptions.booleanFormat takes precedence.
Separated with a colon (:) or semicolon (;), the left side is false
, and the right side is true
.
Example) 'Nub: Yub'
calculated
Is it a calculated field?
Type
- boolean
Remarks:
If valueExpression or valueCallback is set, it is calculated.
dataType
data type
Type
- ValueType
Remarks:
See ValueType
datetimeFormat
Format when the value is in date format
Type
- string
Remarks:
If this value is specified, it is used as a conversion format when outputting the value of a datetime field.
The value set in DataOutputOptions.datetimeFormat takes precedence.
Example) 'yyyy-M-dd'
defaultValue
Default data value for the field
Type
- any
Remarks:
If you specify a default value, the default value specified when calling the GridView.beginInsertRow(), GridView.beginAppendRow() function A new row is added in this input state.
fieldName
field name
Type
- string
Remarks:
When reading, it is output in uppercase letters.
When accessed and set as a property, orgFieldName is set as is, and the property is set to uppercase for internal processing.
header
group header title
Type
- string
Remarks:
When row grouping, the header value of the standard field can be displayed in the title of the group header.
index
index of field
Type
- number
length
data length
Type
- number
maximum
limit value of maximum range
Type
- number
Remarks:
It can be used when the data type is numeric or date type.
minimum
Minimum range limit value
Type
- number
Remarks:
It can be used when the data type is numeric or date type.
nullValue
Data to be replaced when data is null
Type
- any
orgFieldName
Field name at the time of designation
Type
- string
pmText
PM display text
Type
- string
required
Is data required?
Type
- boolean
set
field set
Type
- any[]
Remarks:
If the value is not included in the array, it is stored as undefined
.
It can be used in all data types except the Boolean data type.
subType
Directive for using basic data types to a limited extent
Type
- ValueType
Remarks:
See ValueType
subTypeEnabled
Indicator for using a data type in a limited range Availability
Type
- boolean
updatable
Whether field values can be modified
Type
- boolean
valueExpression
Formula to be used if it is a calculated field
Type
- string
Remarks:
Refer to values['field name'], values[field index].
References to other calculated fields in formulas are not allowed.
Example:
dataField.valueExpression = "values['Quantity'] * values['UnitPrice']";