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
Configs
21Model 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
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 StoreDataField class, or subclass thereof.
Identifies an object as an instance of StoreDataField class, or subclass thereof.
isDataFieldDataField
Functions
19
Functions
19Configuration
Events
detachListenersBase