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
alwaysWriteDataField
calculateDataField
columnDataField
compareDataField
dataSourceDataField
defaultValueDataField
descriptionDataField
internalDataField
labelDataField
nameDataField
nullableDataField
nullTextDataField
nullValueDataField
persistDataField
readOnlyDataField

Properties

7

Class hierarchy

isArrayDataField: Boolean= truereadonly
Identifies an object as an instance of ArrayDataField class, or subclass thereof.
isArrayDataField: Boolean= truereadonlystatic
Identifies an object as an instance of ArrayDataField class, or subclass thereof.
isDataFieldDataField

Lifecycle

configBase

Functions

19

Configuration

applyDefaultsstaticBase

Events

Lifecycle

destroystaticBase

Misc

initClassstaticBase
isOfTypeNamestaticBase
mixinstaticBase

Other

convertDataField
isEqualDataField
printDataField
printValueDataField
serializeDataField