reuse
This commit is contained in:
@ -30,15 +30,11 @@ export class BasicTableComponent implements AfterViewInit, OnDestroy, OnReuseDes
|
||||
|
||||
sf!: SFComponent;
|
||||
sfValue: Record<string, any> = {};
|
||||
drawer: Subscription[] = [];
|
||||
schema: SFSchema = {};
|
||||
|
||||
deviationHeight = 0;
|
||||
|
||||
constructor(public searchDrawerService: SearchDrawerService) {}
|
||||
_onReuseDestroy(): void {
|
||||
this.drawer.forEach(sub => sub.unsubscribe());
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
setTimeout(() => {
|
||||
@ -51,23 +47,31 @@ export class BasicTableComponent implements AfterViewInit, OnDestroy, OnReuseDes
|
||||
});
|
||||
}
|
||||
|
||||
_onReuseDestroy(): void {
|
||||
console.log(1);
|
||||
|
||||
// this.drawer.forEach(sub => sub.unsubscribe());
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.drawer.forEach(sub => sub.unsubscribe());
|
||||
this.searchDrawerService.unsubscribe();
|
||||
}
|
||||
|
||||
openDrawer() {
|
||||
if (this.drawer?.length > 0) {
|
||||
console.log(this.sfValue);
|
||||
|
||||
if (this.searchDrawerService.drawer?.length > 0) {
|
||||
this.searchDrawerService.create(this.sfValue, this.schema);
|
||||
} else {
|
||||
const drawer = this.searchDrawerService.create(this.sfValue, this.schema);
|
||||
this.drawer.push(
|
||||
this.searchDrawerService.drawer.push(
|
||||
drawer.initEvent.subscribe((sf: SFComponent) => {
|
||||
if (sf) {
|
||||
this.sf = sf;
|
||||
}
|
||||
})
|
||||
);
|
||||
this.drawer.push(
|
||||
this.searchDrawerService.drawer.push(
|
||||
drawer.closeEvent.subscribe((res: Record<string, any>) => {
|
||||
this.sfValue = res;
|
||||
if (res) {
|
||||
|
||||
Reference in New Issue
Block a user