StoreChained

Configs

10
chainedFields: String[]

Array of field names that should trigger filtering of chained store when the fields are updated.

Only applies to chained stores

chainedFilterFn: function

Function used to filter records in the masterStore into a chained store. If not provided, all records from the masterStore will be included in the chained store. Return true to include the passed record, or a false to exclude it.

Only applies to chained stores

ParameterTypeDescription
recordModel
Returns: Boolean
chainFilters: Boolean= false

If true, chained stores will apply filters from the master store. Filters flagged with ignoreForChain will be ignored.

Only applies to chained stores

Method names calls to which shouldn't be relayed to master store.

Only applies to chained stores

doRelayToMaster: String[]

Method names calls to which should be relayed to master store.

Only applies to chained stores

If true, collapsed records in original tree will be excluded from the chained store.

Only applies to chained stores, and not when chaining using chainTree()

ignoreLinkRecords: Boolean= false

Set to true to prevent including links (when grouping by array field)

Only applies to chained stores

Master store that a chained store gets its records from.

Only applies to chained stores

syncOrder: Boolean= false

If true, changing the order of records in a flat chained store (for example by using the RowReorder feature in a Grid-based widget) will also change the order of records in the master store.

Note that this config does not apply to chained tree stores (created using chainTree). Chained tree stores always sync the order of their records with the master store.

Example usage:

store.chain(record => record.percent < 10, null, {
  syncOrder : true
});

The predictability of the outcome depends on the order of the records in both stores, and if the subset of records in the chained store is contiguous. For example, if the master store has records A B C D E, and the chained store has E C A, it will be difficult for users to predict the outcome of moving E to between C A.

syncSort: Boolean= true

If true, chained stores will be sorted when the master store is sorted. Note that this replaces any existing sorters defined on the chained store.

Only applies to chained stores

Properties

3

Advanced

isChained: Booleanreadonly

Is this a chained store?

Class hierarchy

isStoreChained: Boolean= truereadonly
Identifies an object as an instance of StoreChained class, or subclass thereof.
isStoreChained: Boolean= truereadonlystatic
Identifies an object as an instance of StoreChained class, or subclass thereof.

Functions

3

Creates a chained store, a new Store instance that contains a subset of the records from current store. Which records is determined by a filtering function, which is reapplied when data in the base store changes.

// Chain all records
const all = store.chain();

// Or a subset using a filter function
const oldies = store.chain(record => record.age > 50);

If you want to chain a tree store, consider using chainTree instead. It will create a new tree store with links to the records in this store. This will let you expand/collapse and filter nodes in the chained store without affecting the original store.

If this store is a tree store, then the resulting chained store will be a tree store sharing the same root node, but only child nodes which pass the chainedFilterFn will be considered when iterating the tree through the methods such as traverse or forEach.

ParameterTypeDescription
chainedFilterFnfunction

An optional filter function called for every record to determine if it should be included (return true / false). Leave it out to include all records.

chainedFieldsString[]

Array of fields that trigger filtering when they are updated

configStoreConfig

Additional chained store configuration. See Store#configs

Returns: Store

Creates a chained tree store, a new Store instance that contains a subset of the records from current store. Which records is determined by a filtering function, which is reapplied when data in the base store changes.

// Chain all nodes
const fullTree = store.chainTree();
// Or a subset
const oldies = store.chainTree(record => record.age > 50);

The resulting chained store will be a tree store with its own root node, under which all children are links to the nodes in this store. This allows for expanding/collapsing and filtering nodes in the chained store without affecting the original store.

ParameterTypeDescription
chainedFilterFnfunction

An optional filter function called for every leaf record to determine if it should be included (return true / false). Leave it out to include all records.

chainedFieldsString[]

Array of fields that trigger filtering when they are updated

configStoreConfig

Additional chained store configuration. See Store#configs

Returns: Store

Updates records available in a chained store by filtering the master store records using chainedFilterFn