Skip to content

Commit 6ed9b28

Browse files
author
Daniel Tsanev
committed
fix(datagrid): skip listening when datagrid have static height
1 parent a626578 commit 6ed9b28

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

projects/angular/clarity.api.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,14 +1249,16 @@ export class ClrDatagridCell implements OnInit {
12491249
export class ClrDatagridColumn<T = any> extends DatagridFilterRegistrar<T, ClrDatagridFilterInterface<T>> implements OnDestroy, OnInit, OnChanges {
12501250
// Warning: (ae-forgotten-export) The symbol "Sort" needs to be exported by the entry point index.d.ts
12511251
// Warning: (ae-forgotten-export) The symbol "FiltersProvider" needs to be exported by the entry point index.d.ts
1252-
constructor(_sort: Sort<T>, filters: FiltersProvider<T>, vcr: ViewContainerRef, detailService: DetailService, changeDetectorRef: ChangeDetectorRef, smartPositionService: ClrPopoverPositionService, smartEventsService: ClrPopoverEventsService);
1252+
constructor(_sort: Sort<T>, filters: FiltersProvider<T>, vcr: ViewContainerRef, detailService: DetailService, changeDetectorRef: ChangeDetectorRef, smartPositionService: ClrPopoverPositionService, smartEventsService: ClrPopoverEventsService, elementRef: ElementRef);
12531253
// (undocumented)
12541254
get ariaSort(): "none" | "ascending" | "descending";
12551255
// (undocumented)
12561256
get colType(): 'string' | 'number';
12571257
set colType(value: 'string' | 'number');
12581258
customFilter: boolean;
12591259
// (undocumented)
1260+
get datagridElementRef(): any;
1261+
// (undocumented)
12601262
get field(): string;
12611263
set field(field: string);
12621264
// (undocumented)

projects/angular/src/data/datagrid/datagrid-column.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
ChangeDetectorRef,
1010
Component,
1111
ContentChild,
12+
ElementRef,
1213
EventEmitter,
1314
Injector,
1415
Input,
@@ -20,7 +21,7 @@ import {
2021
ViewContainerRef,
2122
} from '@angular/core';
2223
import { Subscription } from 'rxjs';
23-
import { debounceTime, tap } from 'rxjs/operators';
24+
import { debounceTime, skipWhile, tap } from 'rxjs/operators';
2425

2526
import { ClrPopoverEventsService, ClrPopoverPositionService } from '../../utils';
2627
import { HostWrapper } from '../../utils/host-wrapping/host-wrapper';
@@ -153,7 +154,8 @@ export class ClrDatagridColumn<T = any>
153154
private detailService: DetailService,
154155
private changeDetectorRef: ChangeDetectorRef,
155156
private smartPositionService: ClrPopoverPositionService,
156-
private smartEventsService: ClrPopoverEventsService
157+
private smartEventsService: ClrPopoverEventsService,
158+
private elementRef: ElementRef
157159
) {
158160
super(filters);
159161
this.subscriptions.push(this.listenForSortingChanges());
@@ -311,6 +313,10 @@ export class ClrDatagridColumn<T = any>
311313
return this.wrappedInjector.get(WrappedColumn, this.vcr).columnView;
312314
}
313315

316+
get datagridElementRef() {
317+
return this.elementRef?.nativeElement?.closest('clr-datagrid');
318+
}
319+
314320
ngOnInit() {
315321
this.wrappedInjector = new HostWrapper(WrappedColumn, this.vcr);
316322
}
@@ -381,6 +387,7 @@ export class ClrDatagridColumn<T = any>
381387
private listenForFilterChanges() {
382388
return this.filter.changes
383389
.pipe(
390+
skipWhile(() => !!this.datagridElementRef?.style.height === true),
384391
tap(() => {
385392
this.smartEventsService.removeScrollListener();
386393
this.smartPositionService.realign();

0 commit comments

Comments
 (0)