Skip to content

Commit bc18a8c

Browse files
MKirovaMKirova
authored andcommitted
feat(GridBase): Apply spec for server-side rendering for relative grid sizes.
1 parent 3fb0f11 commit bc18a8c

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3361,12 +3361,25 @@ export abstract class IgxGridBaseDirective implements GridType,
33613361
private get hasZeroResultFilter(): boolean {
33623362
return this.filteredData && this.filteredData.length === 0;
33633363
}
3364+
protected get totalCalcWidth() {
3365+
return this.platform.isBrowser ? this.calcWidth : undefined;
3366+
}
3367+
3368+
protected get renderData(){
3369+
return this.platform.isBrowser ? this.data : undefined;
3370+
}
3371+
3372+
@HostBinding('style.display')
3373+
protected displayStyle = 'grid';
3374+
3375+
@HostBinding('style.grid-template-rows')
3376+
protected templateRows = 'auto auto auto 1fr auto auto';
33643377

33653378
/**
33663379
* @hidden @internal
33673380
*/
33683381
private get hasNoData(): boolean {
3369-
return !this.data || this.dataLength === 0;
3382+
return !this.data || this.dataLength === 0 || !this.platform.isBrowser;
33703383
}
33713384

33723385
/**
@@ -5158,7 +5171,8 @@ export abstract class IgxGridBaseDirective implements GridType,
51585171

51595172
/** @hidden @internal */
51605173
public get totalHeight() {
5161-
return this.calcHeight ? this.calcHeight + this.pinnedRowHeight : this.calcHeight;
5174+
const height = this.calcHeight ? this.calcHeight + this.pinnedRowHeight : this.calcHeight;
5175+
return this.platform.isBrowser ? height : undefined;
51625176
}
51635177

51645178
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<div class="igx-grid__tbody-content" tabindex="0" [attr.role]="dataView.length ? null : 'row'" (keydown)="navigation.handleNavigation($event)" (focus)="navigation.focusTbody($event)"
3535
(dragStop)="selectionService.dragMode = $event" (scroll)="preventContainerScroll($event)"
3636
(dragScroll)="dragScroll($event)" [igxGridDragSelect]="selectionService.dragMode"
37-
[style.height.px]="totalHeight" [style.width.px]="calcWidth || null" #tbody [attr.aria-activedescendant]="activeDescendant">
37+
[style.height.px]="totalHeight" [style.width.px]="totalCalcWidth" [style.width]="'100%'" #tbody [attr.aria-activedescendant]="activeDescendant">
3838
@if (moving && columnInDrag && pinnedColumns.length <= 0) {
3939
<span
4040
[igxColumnMovingDrop]="headerContainer" [attr.droppable]="true" id="left"
@@ -70,7 +70,7 @@
7070
}
7171
}
7272
</ng-template>
73-
<ng-template igxGridFor let-rowData [igxGridForOf]="data
73+
<ng-template igxGridFor let-rowData [igxGridForOf]="renderData
7474
| gridTransaction:id:pipeTrigger
7575
| visibleColumns:hasVisibleColumns
7676
| gridFiltering:filteringExpressionsTree:filterStrategy:advancedFilteringExpressionsTree:id:pipeTrigger:filteringPipeTrigger

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<div class="igx-grid__tbody-content" tabindex="0" (focus)="navigation.focusTbody($event)"
2121
(keydown)="navigation.handleNavigation($event)" (dragStop)="selectionService.dragMode = $event"
2222
(dragScroll)="dragScroll($event)" [igxGridDragSelect]="selectionService.dragMode" [attr.aria-activedescendant]="activeDescendant" [attr.role]="dataView.length ? null : 'row'"
23-
[style.height.px]="totalHeight" [style.width.px]="calcWidth" #tbody (scroll)="preventContainerScroll($event)">
23+
[style.height.px]="totalHeight" [style.width.px]="totalCalcWidth" [style.width]="'100%'" #tbody (scroll)="preventContainerScroll($event)">
2424
@if (moving && columnInDrag && pinnedColumns.length <= 0) {
2525
<span
2626
[igxColumnMovingDrop]="headerContainer" [attr.droppable]="true" id="left"
@@ -54,7 +54,7 @@
5454
</ng-template>
5555
<ng-container *ngTemplateOutlet="hasPinnedRecords && isRowPinningToTop ? pinnedRecordsTemplate : null">
5656
</ng-container>
57-
<ng-template igxGridFor let-rowData let-rowIndex="index" [igxGridForOf]="data
57+
<ng-template igxGridFor let-rowData let-rowIndex="index" [igxGridForOf]="renderData
5858
| gridTransaction:id:pipeTrigger
5959
| visibleColumns:hasVisibleColumns
6060
| gridFiltering:filteringExpressionsTree:filterStrategy:advancedFilteringExpressionsTree:id:pipeTrigger:filteringPipeTrigger

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<div class="igx-grid__tbody-content" tabindex="0" [attr.role]="dataView.length ? null : 'row'" (keydown)="navigation.handleNavigation($event)" (focus)="navigation.focusTbody($event)"
2323
(dragStop)="selectionService.dragMode = $event" (scroll)="preventContainerScroll($event)"
2424
(dragScroll)="dragScroll($event)" [igxGridDragSelect]="selectionService.dragMode"
25-
[style.height.px]="totalHeight" [style.width.px]="pivotContentCalcWidth || null" #tbody [attr.aria-activedescendant]="activeDescendant">
25+
[style.height.px]="totalHeight" [style.width.px]="pivotContentCalcWidth || null" [style.width]="'100%'" #tbody [attr.aria-activedescendant]="activeDescendant">
2626
@if (hasMovableColumns && columnInDrag && pinnedColumns.length <= 0) {
2727
<span [igxColumnMovingDrop]="headerContainer" [attr.droppable]="true" id="left"
2828
class="igx-grid__scroll-on-drag-left"></span>
@@ -31,7 +31,7 @@
3131
<span [igxColumnMovingDrop]="headerContainer" [attr.droppable]="true" id="left"
3232
class="igx-grid__scroll-on-drag-pinned" [style.left.px]="pinnedWidth"></span>
3333
}
34-
<ng-template igxGridFor let-rowData [igxGridForOf]="data
34+
<ng-template igxGridFor let-rowData [igxGridForOf]="renderData
3535
| pivotGridFilter:pivotConfiguration:filterStrategy:advancedFilteringExpressionsTree:filteringPipeTrigger:pipeTrigger
3636
| pivotGridSort:pivotConfiguration:sortStrategy:pipeTrigger
3737
| pivotGridRow:pivotConfiguration:pivotValueCloneStrategy:expansionStates:pipeTrigger:sortingExpressions

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,9 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
12901290

12911291
/** @hidden @internal */
12921292
public get pivotContentCalcWidth() {
1293+
if (!this.platform.isBrowser) {
1294+
return undefined;
1295+
}
12931296
if (!this.visibleRowDimensions.length) {
12941297
return Math.max(0, this.calcWidth - this.pivotRowWidths);
12951298
}

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
@@ -19,7 +19,7 @@
1919
<div class="igx-grid__tbody-content" tabindex="0" (focus)="navigation.focusTbody($event)" (keydown)="navigation.handleNavigation($event)"
2020
(dragStop)="selectionService.dragMode = $event" [attr.aria-activedescendant]="activeDescendant" [attr.role]="dataView.length ? null : 'row'"
2121
(dragScroll)="dragScroll($event)" [igxGridDragSelect]="selectionService.dragMode"
22-
[style.height.px]='totalHeight' [style.width.px]='calcWidth' #tbody (scroll)='preventContainerScroll($event)'>
22+
[style.height.px]='totalHeight' [style.width.px]="totalCalcWidth" [style.width]="'100%'" #tbody (scroll)='preventContainerScroll($event)'>
2323
@if (moving && columnInDrag && pinnedColumns.length <= 0) {
2424
<span
2525
[igxColumnMovingDrop]="headerContainer" [attr.droppable]="true" id="left"
@@ -56,7 +56,7 @@
5656
}
5757
</ng-template>
5858
<ng-container *ngTemplateOutlet="hasPinnedRecords && isRowPinningToTop ? pinnedRecordsTemplate : null"></ng-container>
59-
<ng-template igxGridFor let-rowData [igxGridForOf]="data
59+
<ng-template igxGridFor let-rowData [igxGridForOf]="renderData
6060
| treeGridTransaction:pipeTrigger
6161
| visibleColumns:hasVisibleColumns
6262
| treeGridHierarchizing:primaryKey:foreignKey:childDataKey:pipeTrigger

0 commit comments

Comments
 (0)