diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f8909da591..f1cd562f37e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ All notable changes for each version of this project will be documented in this - **Deprecation** - `tabIndex` has been deprecated and will be removed in a future version. - `IgxGrid`, `IgxHierarchicalGrid`, `IgxTreeGrid` - A column's `minWidth` and `maxWidth` constrain the user-specified `width` so that it cannot go outside their bounds. + - In SSR mode grid with height 100% or with no height will render on the server with % size and with no data. The grid will show either the empty grid template or the loading indicator (if isLoading is true). + - In SSR mode grid with width 100% or with no width will render on the server with % size and with all columns. ## 19.1.1 ### New Features diff --git a/projects/igniteui-angular/src/lib/grids/grid-base.directive.ts b/projects/igniteui-angular/src/lib/grids/grid-base.directive.ts index 4d02cd45be2..065a9d00b19 100644 --- a/projects/igniteui-angular/src/lib/grids/grid-base.directive.ts +++ b/projects/igniteui-angular/src/lib/grids/grid-base.directive.ts @@ -3364,12 +3364,26 @@ export abstract class IgxGridBaseDirective implements GridType, private get hasZeroResultFilter(): boolean { return this.filteredData && this.filteredData.length === 0; } + protected get totalCalcWidth() { + return this.platform.isBrowser ? this.calcWidth : undefined; + } + + protected get renderData() { + // omit data if not in the browser and size is % + return !this.platform.isBrowser && this.isPercentHeight ? undefined : this.data; + } + + @HostBinding('style.display') + protected displayStyle = 'grid'; + + @HostBinding('style.grid-template-rows') + protected templateRows = 'auto auto auto 1fr auto auto'; /** * @hidden @internal */ private get hasNoData(): boolean { - return !this.data || this.dataLength === 0; + return !this.data || this.dataLength === 0 || !this.platform.isBrowser; } /** @@ -5169,7 +5183,8 @@ export abstract class IgxGridBaseDirective implements GridType, /** @hidden @internal */ public get totalHeight() { - return this.calcHeight ? this.calcHeight + this.pinnedRowHeight : this.calcHeight; + const height = this.calcHeight ? this.calcHeight + this.pinnedRowHeight : this.calcHeight; + return this.platform.isBrowser ? height : undefined; } /** diff --git a/projects/igniteui-angular/src/lib/grids/grid/grid.component.html b/projects/igniteui-angular/src/lib/grids/grid/grid.component.html index 900ac1c9572..e5db8db8d69 100644 --- a/projects/igniteui-angular/src/lib/grids/grid/grid.component.html +++ b/projects/igniteui-angular/src/lib/grids/grid/grid.component.html @@ -34,7 +34,7 @@