ArrayDataField
This field class handles fields that hold an array.
class Task extends Model {
static get fields() {
return [
'name',
// Array field
{ name : 'todo', type : 'array' }
];
}
}
A record can be constructed like this:
const task = new Task({
name : 'Task 1',
todo : [
{ text : 'Something', done : false },
{ text : 'Some other thing', done : true }
]
};
Or by populating a store:
const store = new Store({
modelClass : Task,
data : [
{
name : 'Task 1',
todo : [
{ text : 'Something', done : false },
{ text : 'Some other thing', done : true }
]
},
...
]
});
For the field to count as modified, the whole array has to be replaced:
// This won't be detected as a modification
task.todo[0].done = true;
// task.isModified === false
// But this will
const todo = task.todo.slice(); // Create a new array with same contents
todo[0].done = true;
task.todo = todo;
// task.isModified === true
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 ArrayDataField class, or subclass thereof.
Identifies an object as an instance of ArrayDataField class, or subclass thereof.
isDataFieldDataField
Functions
19
Functions
19Configuration
Events
detachListenersBase