Skip to content

Commit

Permalink
[docs] Document aggregation selectors (#7148)
Browse files Browse the repository at this point in the history
Closes #7129
  • Loading branch information
cherniavskii committed Dec 9, 2022
1 parent 9dfee2f commit 26dd361
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/data/data-grid/aggregation/aggregation.md
Expand Up @@ -294,6 +294,10 @@ In the example below, you can see that all the aggregation functions are rendere

{{"demo": "AggregationRenderCell.js", "bg": "inline", "defaultCodeOpen": false}}

## Selectors

{{"component": "modules/components/SelectorsDocs.js", "category": "Aggregation"}}

## API

- [DataGrid](/x/api/data-grid/data-grid/)
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/x/api/data-grid/selectors.json
Expand Up @@ -2,13 +2,15 @@
{
"name": "gridAggregationLookupSelector",
"returnType": "GridAggregationLookup",
"description": "",
"category": "Aggregation",
"description": "Get the aggregation results as a lookup.",
"supportsApiRef": true
},
{
"name": "gridAggregationModelSelector",
"returnType": "GridAggregationModel",
"description": "",
"category": "Aggregation",
"description": "Get the aggregation model, containing the aggregation function of each column.\nIf a column is not in the model, it is not aggregated.",
"supportsApiRef": true
},
{
Expand Down
Expand Up @@ -3,11 +3,20 @@ import { GridStatePremium } from '../../../models/gridStatePremium';

export const gridAggregationStateSelector = (state: GridStatePremium) => state.aggregation;

/**
* Get the aggregation model, containing the aggregation function of each column.
* If a column is not in the model, it is not aggregated.
* @category Aggregation
*/
export const gridAggregationModelSelector = createSelector(
gridAggregationStateSelector,
(aggregationState) => aggregationState.model,
);

/**
* Get the aggregation results as a lookup.
* @category Aggregation
*/
export const gridAggregationLookupSelector = createSelector(
gridAggregationStateSelector,
(aggregationState) => aggregationState.lookup,
Expand Down

0 comments on commit 26dd361

Please sign in to comment.