Skip to content

Commit f00c2c9

Browse files
authored
Merge pull request #4291 from IgniteUI/sstoychev/fix-4278-6.2
fix(grid): forcing calcwidth on pinning init #4278 - 6.2
2 parents 0ed9a6d + c181a95 commit f00c2c9

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4141,9 +4141,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
41414141
const unpinnedColumns = [];
41424142
const newUnpinnedCols = [];
41434143

4144-
if (this.calcWidth === 0) {
4145-
this.calculateGridWidth();
4146-
}
4144+
this.calculateGridWidth();
41474145
// When a column is a group or is inside a group, pin all related.
41484146
this._pinnedColumns.forEach(col => {
41494147
if (col.parent) {

projects/igniteui-angular/src/lib/grids/grid/column-group.spec.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,14 @@ describe('IgxGrid - multi-column headers', () => {
812812
testColumnPinning(ci.genInfoColGroup, true);
813813
}));
814814

815+
it('Should initially pin the whole group when one column of the group is pinned', fakeAsync(() => {
816+
const fixture = TestBed.createComponent(ThreeGroupsThreeColumnsGridComponent);
817+
fixture.componentInstance.cnPinned = true;
818+
fixture.detectChanges();
819+
const contactTitle = fixture.componentInstance.grid.getColumnByName('ContactTitle');
820+
expect(contactTitle.pinned).toBeTruthy();
821+
}));
822+
815823
it('Should not allow moving group to another level via API.', () => {
816824
const fixture = TestBed.createComponent(ColumnGroupTestComponent);
817825
fixture.detectChanges();
@@ -1645,7 +1653,7 @@ export class ColumnGroupTwoGroupsTestComponent {
16451653
template: `
16461654
<igx-grid #grid [data]="data" height="600px" width="1000px">
16471655
<igx-column-group #genInfoColGroup header="General Information">
1648-
<igx-column #companyNameCol field="CompanyName"></igx-column>
1656+
<igx-column #companyNameCol field="CompanyName" [pinned]="cnPinned"></igx-column>
16491657
<igx-column #contactNameCol field="ContactName"></igx-column>
16501658
<igx-column #contactTitleCol field="ContactTitle"></igx-column>
16511659
</igx-column-group>
@@ -1694,6 +1702,7 @@ export class ThreeGroupsThreeColumnsGridComponent {
16941702
postalCodeCol: IgxColumnComponent;
16951703

16961704
data = SampleTestData.contactInfoDataFull();
1705+
public cnPinned = false;
16971706
}
16981707

16991708
@Component({

0 commit comments

Comments
 (0)