Skip to content

Commit ec809e8

Browse files
MKirovaMKirova
authored andcommitted
fix(igxGrid): Fixing sizing in flexible layout so that grid content can be sized down after being rendered once and then window is resized.
1 parent 7c4c030 commit ec809e8

File tree

7 files changed

+50
-14
lines changed

7 files changed

+50
-14
lines changed

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-theme.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@
664664
%grid-thead-container {
665665
grid-row: 3;
666666
display: flex;
667+
overflow: hidden;
667668

668669
%igx-grid__drag-indicator {
669670
cursor: default;
@@ -812,6 +813,7 @@
812813
position: relative;
813814
display: flex;
814815
grid-row: 4;
816+
overflow: hidden;
815817
}
816818

817819
%grid-tbody-message {
@@ -842,6 +844,7 @@
842844
width: 100%;
843845
background: --var($theme, 'header-background');
844846
z-index: 10001;
847+
overflow: hidden;
845848
}
846849

847850
%grid-thead-thumb {
@@ -856,6 +859,7 @@
856859

857860
%grid-tbody-scrollbar {
858861
border-left: 1px solid igx-color($palette, 'grays', 300);
862+
position: relative;
859863
}
860864

861865
%grid-scroll-start {
@@ -1769,6 +1773,7 @@
17691773
padding: map-get($grouparea-padding, 'comfortable');
17701774
z-index: 2;
17711775
height: 100%;
1776+
overflow: hidden;
17721777

17731778
&:focus {
17741779
outline-style: none;

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2749,7 +2749,11 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
27492749
});
27502750

27512751
this.resizeNotify.pipe(destructor, filter(() => !this._init), throttleTime(40))
2752-
.subscribe(() => this.notifyChanges(true));
2752+
.subscribe(() => {
2753+
this.zone.run(() => {
2754+
this.notifyChanges(true);
2755+
});
2756+
});
27532757

27542758
this.onPagingDone.pipe(destructor).subscribe(() => {
27552759
this.endEdit(true);

projects/igniteui-angular/src/lib/grids/grid/grid.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<igx-grid-toolbar [style.width.px]="outerWidth" role="rowgroup" *ngIf="showToolbar" [gridID]="id"
1+
<igx-grid-toolbar [style.flex-basis.px]="outerWidth" role="rowgroup" *ngIf="showToolbar" [gridID]="id"
22
[displayDensity]="displayDensity" #toolbar>
33
</igx-grid-toolbar>
44

5-
<div [style.width.px]='outerWidth' class="igx-grid__grouparea"
5+
<div [style.flex-basis.px]='outerWidth' class="igx-grid__grouparea"
66
*ngIf="groupingExpressions.length > 0 || hasGroupableColumns" #groupArea>
77
<igx-chips-area (onReorder)="chipsOrderChanged($event)" (onMoveEnd)="chipsMovingEnded()">
88
<ng-container *ngFor="let expr of chipsGoupingExpressions; let last = last;">
@@ -29,7 +29,7 @@
2929

3030
<div class="igx-grid__thead">
3131
<div class="igx-grid__thead-wrapper" [class.igx-grid__tr--mrl]='hasColumnLayouts' role="rowgroup"
32-
[style.width.px]='calcWidth' #theadRow>
32+
[style.width.px]='calcWidth' #theadRow>
3333
<div class="igx-grid__tr" role="row" [style.width.px]='calcWidth'>
3434
<span *ngIf="hasMovableColumns && draggedColumn && pinnedColumns.length <= 0"
3535
[igxColumnMovingDrop]="parentVirtDir" [attr.droppable]="true" id="left"

projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<igx-grid-toolbar role="rowgroup" [style.width.px]="outerWidth" *ngIf="showToolbar" [gridID]="id"
1+
<igx-grid-toolbar role="rowgroup" [style.flex-basis.px]="outerWidth" *ngIf="showToolbar" [gridID]="id"
22
[displayDensity]="displayDensity" #toolbar>
33
</igx-grid-toolbar>
44

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<igx-grid-toolbar role="rowgroup" [style.width.px]='outerWidth' *ngIf="showToolbar" [gridID]="id"
1+
<igx-grid-toolbar role="rowgroup" [style.flex-basis.px]='outerWidth' *ngIf="showToolbar" [gridID]="id"
22
[displayDensity]="displayDensity" #toolbar>
33
</igx-grid-toolbar>
44

@@ -105,7 +105,7 @@
105105
</div>
106106
</div>
107107

108-
<div class="igx-grid__tfoot" [style.width.px]='outerWidth' role="rowgroup" [style.height.px]='summariesHeight' #tfoot>
108+
<div class="igx-grid__tfoot" role="rowgroup" [style.height.px]='summariesHeight' #tfoot>
109109
<igx-grid-summary-row [style.width.px]='calcWidth' [style.height.px]='summariesHeight'
110110
*ngIf="hasSummarizedColumns && rootSummariesEnabled" [gridID]="id"
111111
[summaries]="id | igxGridSummaryDataPipe:summaryService.retriggerRootPipe" [index]="0"

src/app/grid-flex-layout/grid-flex.sample.html

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22
<div igxFlex igxLayout igxLayoutDir="column">
33
<div igxFlex>
44
<h4 class="sample-title">Grid1</h4>
5-
<igx-grid #grid1 [data]="localData" [autoGenerate]="true">
5+
<igx-grid #grid1 [columnPinning]='true' [paging]='true' [data]="localData" [showToolbar]='true' [autoGenerate]="false">
6+
<igx-column *ngFor="let c of columns" [field]="c.field"
7+
[header]="c.field"
8+
[resizable]="true"
9+
[width]="c.width"
10+
[groupable] = 'true'
11+
[hasSummary] = 'true'
12+
[minWidth]="c.minWidth"
13+
[maxWidth]="c.maxWidth" [editable]='true'>
14+
</igx-column>
615
</igx-grid>
716

817
</div>
@@ -11,5 +20,19 @@ <h4 class="sample-title">Grid2</h4>
1120
<igx-grid #grid2 [data]="localData" [autoGenerate]="true">
1221
</igx-grid>
1322
</div>
23+
24+
<div igxFlex>
25+
<h4 class="sample-title">HGrid</h4>
26+
<igx-hierarchical-grid [showToolbar]='true' [data]="localData" [autoGenerate]="true" #hGrid2>
27+
<igx-row-island [key]="'childData'" [autoGenerate]="true" [allowFiltering]='true' >
28+
</igx-row-island>
29+
</igx-hierarchical-grid>
30+
</div>
31+
32+
<div igxFlex>
33+
<h4 class="sample-title">TreeGrid</h4>
34+
<igx-tree-grid childDataKey="Child" [data]="localData" [autoGenerate]="true">
35+
</igx-tree-grid>
36+
</div>
1437
</div>
1538
</div>

src/app/grid-flex-layout/grid-flex.sample.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,21 @@ export class GridFlexSampleComponent implements OnInit, AfterViewInit {
1313
public localData;
1414
@ViewChild('grid1', { static: true })
1515
grid1: IgxGridComponent;
16+
columns;
1617

1718
constructor(){
1819
}
1920

2021
ngOnInit() {
21-
this.localData = [
22-
{ ID: 1, Name: 'A' },
23-
{ ID: 2, Name: 'B' },
24-
{ ID: 3, Name: 'C' },
25-
{ ID: 4, Name: 'D' },
26-
{ ID: 5, Name: 'E' }
22+
const data = [];
23+
for (let i = 0; i < 20; i++) {
24+
data.push( { ID: i, Name: 'A' + i });
25+
}
26+
this.localData = data;
27+
28+
this.columns = [
29+
{ field: 'ID', width: 800, resizable: true, maxWidth: 1000, minWidth: 70 },
30+
{ field: 'Name', width: 800, resizable: true, maxWidth: 1000, minWidth: 70 }
2731
];
2832
}
2933
ngAfterViewInit() {

0 commit comments

Comments
 (0)