Skip to content

Commit c839f15

Browse files
MKirovaMKirova
authored andcommitted
Split parent size equally between value columns.
1 parent ae3a586 commit c839f15

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,12 +1053,15 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
10531053

10541054
protected getMeasureChildren(colFactory, data, parent, hidden, parentWidth) {
10551055
const cols = [];
1056+
const count = this.values.length;
1057+
const width = parentWidth ? parseInt(parentWidth, 10) / count : MINIMUM_COLUMN_WIDTH;
1058+
const isPercent = parentWidth && parentWidth.indexOf('%') !== -1;
10561059
this.values.forEach(val => {
10571060
const ref = colFactory.create(this.viewRef.injector);
10581061
ref.instance.header = val.displayName || val.member;
10591062
ref.instance.field = parent.field + '-' + val.member;
10601063
ref.instance.parent = parent;
1061-
ref.instance.width = parentWidth || MINIMUM_COLUMN_WIDTH + 'px';
1064+
ref.instance.width = isPercent ? width + '%' : width + 'px';
10621065
ref.instance.hidden = hidden;
10631066
ref.instance.dataType = val.dataType || this.resolveDataTypes(data[0][val.member]);
10641067
ref.instance.formatter = val.formatter;

src/app/pivot-grid/pivot-grid.sample.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class PivotGridSampleComponent {
2727
{
2828
memberName: 'Country',
2929
enabled: true,
30-
width: '20%'
30+
width: '500px'
3131
}
3232
]
3333
,

0 commit comments

Comments
 (0)