StoreGroup
Configs
2
Configs
2Common
Initial groupers, specify to have store grouped automatically after initially setting data
Advanced
To have all groups initially loaded start collapsed, configure this as true.
Note that this only affects the initial load of the store. Subsequent reloads maintain current group state where possible.
Properties
5
Properties
5Class hierarchy
Other
Returns all the group header records
Sort, group & filter
Currently used groupers. To set groupers when remote sorting is enabled by sortParamName you should use setGroupers instead to be able to wait for the operation to finish.
Is store currently grouped?
Functions
6
Functions
6Removes all groupers, turning store grouping off.
If sortParamName is set on store, this method returns Promise
which is resolved after data is loaded from remote server, otherwise it returns null
Returns all records in the group with specified groupValue.
| Parameter | Type | Description |
|---|---|---|
groupValue | * |
Records in specified group or null if store not grouped
Group records, either by replacing current sorters or by adding to them.
A grouper can specify a custom sorting function which will be called with arguments (recordA, recordB).
Works in the same way as a standard array sorter, except that returning null triggers the stores
normal sorting routine. Grouped store must always be sorted by the same field.
To clear groupers and stop grouping, use clearGroupers method.
// simple grouper
store.group('city');
// grouper as object, descending order
store.group({ field : 'city', ascending : false });
// using custom sorting function
store.group({
field : 'city',
fn : (recordA, recordB) => {
// apply custom logic, for example:
return recordA.city.length < recordB.city.length ? -1 : 1;
}
});
// Stop grouping
store.clearGroupers();
| Parameter | Type | Description |
|---|---|---|
field | String | Object | Field to group by.
Can also be a config containing a field to group by and a custom sorting function called |
field.field | String | Field to group by |
field.fn | function | Custom sorting function |
field.ascending | Boolean | Sort order of the group titles |
ascending | Boolean | Sort order of the group titles |
add | Boolean | Add a grouper (true) or use only this grouper (false) |
performSort | Boolean | Trigger sort directly, which does the actual grouping |
silent | Boolean | Set as true to not fire events |
If sortParamName is set on store, this method returns Promise
which is resolved after data is loaded from remote server, otherwise it returns null
Check if a record belongs to a certain group (only for the first grouping level)
| Parameter | Type | Description |
|---|---|---|
record | Model | The Record |
groupValue | * | The group value |
True if the record belongs to the group, otherwise false
Set groupers.
| Parameter | Type | Description |
|---|---|---|
groupers | Grouper[] | Array of groupers to apply to store |
If sortParamName is set on store, this method returns
Promise which is resolved after data is loaded from remote server, otherwise it returns null
Events
1
Events
1Event handlers
1
Event handlers
1Typedefs
1
Typedefs
1An immutable object representing a store grouper.
| Parameter | Type | Description |
|---|---|---|
field | String | Field name |
ascending | Boolean |
|