Skip to content

Commit 88d47d9

Browse files
MKirovaMKirova
authored andcommitted
Show expander only if there's a hierarchy defined via childLevels. Otherwise do not render an expander.
1 parent e872506 commit 88d47d9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
203203
const fieldColumn = parentCols.filter(x => x.header === col.header && !x.columnGroup)[0];
204204
const groupColumn = parentCols.filter(x => x.header === col.header && x.columnGroup)[0];
205205
groupColumn.hidden = newState;
206-
if (!groupColumn.hidden && groupColumn.children.length > 1) {
206+
const hasChildGroup = groupColumn.children.filter(x => x.columnGroup).length > 0;
207+
if (!groupColumn.hidden && hasChildGroup) {
207208
// column group when shown displays all children, we want to show only groups
208209
const fieldChildren = groupColumn.children.filter(x => !x.columnGroup);
209210
fieldChildren.forEach(fieldChild => {
@@ -263,7 +264,9 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
263264
ref.instance.header = key;
264265
ref.instance.parent = parent;
265266
ref.instance.header = parent != null ? key.split(parent.header + '-')[1] : key;
266-
ref.instance.headerTemplate = this.headerTemplate;
267+
if (value.expandable) {
268+
ref.instance.headerTemplate = this.headerTemplate;
269+
}
267270
const children = this.generateColumnHierarchy(value.children, data, ref.instance);
268271

269272
const refSibling = factoryColumn.create(this.viewRef.injector);

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-util.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export class PivotUtil {
3636
if (col.childLevels != null && col.childLevels.length > 0) {
3737
const childValues = this.extractValuesFromDimension(col.childLevels, recData);
3838
vals[lvl].children = childValues;
39+
vals[lvl].expandable = true;
3940
}
4041
lvl++;
4142
if(!lvlCollection[0].children) {

0 commit comments

Comments
 (0)