StoreDataField

This field class handles fields that accepts an array that is then converted to a store.

class Task extends Model {
    static fields = [
        'name',
        // Store field
        { name : 'subTasks', type : 'store', storeClass : Store }
    ];
}

A record can be constructed like this:

const task = new Task({
    name : 'Task 1',
    subTasks : [
        { 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',
            subTasks : [
                { text : 'Something', done : false },
                { text : 'Some other thing', done : true }
            ]
        },
        ...
    ]
});

Whenever the store or its records are manipulated, the field will be marked as modified:

// These will all be detected as modifications
task.subTasks.first.done = true;
task.subTasks.last.remove();
task.subTasks.add({ text : 'New task', done : false });
Note that the underlying store by default will be configured with syncDataOnLoad set to true

Configs

21

Model class to use for the store (can also be configured as usual on the store class, this config is for convenience).

class TodoItem extends Model {
  ...
}

const task = new Store({
    static fields = [
        { type : 'store', name: 'todoItems', storeClass : Store, modelClass : TodoItem }
    ]
});

Optional store configuration object to apply when creating the store.

const task = new Store({
    static fields = [
        {
            type       : 'store',
            name       : 'todoItems',
            storeClass : Store
            store      : {
                 syncDataOnLoad : false
            }
        }
    ]
});

Store class to use when creating the store.

class TodoStore extends Store {
    ...
}

const task = new Store({
    static fields = [
        { type : 'store', name: 'todoItems', storeClass : TodoStore }
    ]
});
alwaysWriteDataField
calculateDataField
columnDataField
compareDataField
dataSourceDataField
defaultValueDataField
descriptionDataField
internalDataField
labelDataField
nameDataField
nullableDataField
nullTextDataField
nullValueDataField
persistDataField
readOnlyDataField

Properties

7

Class hierarchy

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

Lifecycle

configBase

Functions

19

Configuration

applyDefaultsstaticBase

Events

Lifecycle

destroystaticBase

Misc

initClassstaticBase
isOfTypeNamestaticBase
mixinstaticBase

Other

convertDataField
isEqualDataField
printDataField
printValueDataField
serializeDataField