ObjectDataField
This field class handles fields that hold an object.
class Person extends Model {
static fields = [
'name',
{ name : 'address', type : 'object' }
];
}
For the field to count as modified, the whole object has to be replaced:
person.address = { ...address };
Or, sub properties of the object has to be modified using calls to set():
person.set('address.street', 'Main Street');
Note that if any property of the nested object requires conversion after load, you have to define that property as a field:
class Order extends Model {
static fields = [
'title',
{ name : 'details', type : 'object' },
{ name : 'details.date', type : 'date' }
];
}
const order = new Order({
title : 'Order 1',
details : {
customer : 'Bill',
// Definition above required for this to be converted to a date
date : '2020-01-01'
}
});
Configs
18
Configs
18alwaysWriteDataField
bypassEqualityOnSyncDatasetDataField
calculateDataField
columnDataField
compareDataField
complexMappingDataField
dataSourceDataField
defaultValueDataField
descriptionDataField
formulaProvidersDataField
internalDataField
labelDataField
nameDataField
nullableDataField
nullTextDataField
nullValueDataField
persistDataField
readOnlyDataField
Properties
7
Properties
7Class hierarchy
Identifies an object as an instance of ObjectDataField class, or subclass thereof.
Identifies an object as an instance of ObjectDataField class, or subclass thereof.
isDataFieldDataField
Functions
19
Functions
19Configuration
Events
detachListenersBase