diff --git a/lib/core/datatable/components/datatable/datatable.component.html b/lib/core/datatable/components/datatable/datatable.component.html index a2e1161466..fdc0ac2326 100644 --- a/lib/core/datatable/components/datatable/datatable.component.html +++ b/lib/core/datatable/components/datatable/datatable.component.html @@ -42,7 +42,6 @@ -
@@ -191,6 +190,9 @@
+
+
(); + /** This array of fake rows fix the flex layout for the gallery view */ + fakeRows = []; + private clickObserver: Observer; private click$: Observable; @@ -188,6 +191,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, }) ); } + this.datatableLayoutFix(); this.setTableSchema(); } @@ -220,6 +224,10 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, if (this.isPropertyChanged(changes['sorting'])) { this.setTableSorting(changes['sorting'].currentValue); } + + if (this.isPropertyChanged(changes['display'])) { + this.datatableLayoutFix(); + } } ngDoCheck() { @@ -654,4 +662,16 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, this.dataRowsChanged = null; } } + + datatableLayoutFix() { + const maxGalleryRows = 25; + + if (this.display === 'gallery') { + for (let i = 0; i < maxGalleryRows; i++) { + this.fakeRows.push(''); + } + } else { + this.fakeRows = []; + } + } }