Browse Source
Refactor spinner and placeholder handling in directive
pull/23659/head
Yağmur Çelik
9 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
7 additions and
4 deletions
-
npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts
|
|
|
@ -111,10 +111,13 @@ export class NgxDatatableListDirective implements OnChanges, OnInit, DoCheck { |
|
|
|
|
|
|
|
const spinnerRef = this.viewContainerRef.createComponent(SpinnerComponent); |
|
|
|
const spinnerElement = spinnerRef.location.nativeElement; |
|
|
|
if (placeholder?.parentNode === parent) { |
|
|
|
this.renderer.insertBefore(parent, spinnerElement, placeholder); |
|
|
|
|
|
|
|
this.renderer.insertBefore(parent, spinnerElement, parent.firstChild); |
|
|
|
|
|
|
|
const placeholderParent = placeholder?.parentNode as Element | null; |
|
|
|
if (placeholderParent) { |
|
|
|
this.renderer.removeChild(placeholderParent, placeholder); |
|
|
|
} |
|
|
|
this.renderer.removeChild(parent, placeholder); |
|
|
|
} |
|
|
|
|
|
|
|
protected setInitialValues() { |
|
|
|
@ -185,4 +188,4 @@ export class NgxDatatableListDirective implements OnChanges, OnInit, DoCheck { |
|
|
|
this.setTablePage(maxPage); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |