-
Notifications
You must be signed in to change notification settings - Fork 161
fix(pivot-grid): Handle currency pivot values with count aggregator - 19.2.x #15428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 19.2.x
Are you sure you want to change the base?
Conversation
projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid-state.service.ts
Outdated
Show resolved
Hide resolved
@@ -1338,6 +1338,8 @@ export interface PivotGridType extends GridType { | |||
excelStyleFilterMinHeight: string; | |||
valueChipTemplate: TemplateRef<any>; | |||
rowDimensionHeaderTemplate: TemplateRef<IgxColumnTemplateContext>; | |||
/** @hidden @internal */ | |||
currencyColumnSet: Set<string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to store the current currency columns? It doesn't seem to matter what their individual dataType
is as we need to change them all anyway based on the IPivotValue
's dataType
and current selected aggregator.
-
pivot value with
dataType
= "currency" + selected aggregator with aggregatorName: "COUNT" => All columns associated with it need to setdataType
= "number" (doesn't matter what their state was before that). -
pivot value with
dataType
= "currency" + selected aggregator with aggregatorName: "Not COUNT"=> All columns associated with it need to setdataType
= "currency" (doesn't matter what their state was before that).
Also there's a third numeric data type: GridColumnDataType.Percent
which we should also consider. It should also change the column types to number for Count
.
private handleCountAggregator() { | ||
const valueMember = this.value.member; | ||
const columns = this.grid.columns; | ||
const isCountAggregator = this.value.aggregate.key.toLowerCase() === 'count'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key
is user set and will not necessarily match with count
. Would be better to check aggregatorName
or the actual aggregator
.
|
||
columns.forEach(column => { | ||
const isRelevantColumn = column.field?.includes(valueMember); | ||
const isCurrencyColumn = column.dataType === GridColumnDataType.Currency; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't care about the individual columns dataType. Just if the value
's dataType
is currency or percent.
- If it is and has count aggregator -> all column become number.
- If it does not have a count aggregator -> all columns become currency.
No need to store and manage column state.
this.grid.pipeTrigger++; | ||
} | ||
} | ||
|
||
private handleCountAggregator() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a method with the same name and same code in the pivot selector. Perhaps set it somewhere where it can be re-used. Maybe in the pivot grid component since both should have access to it or in as a common util function?
Closes #15148
Additional information (check all that apply):
Checklist:
feature/README.MD
updates for the feature docsREADME.MD
CHANGELOG.MD
updates for newly added functionalityng update
migrations for the breaking changes (migrations guidelines)