feat: RefreshService zu UserComponent hinzugefügt und angewendet

This commit is contained in:
Developer 02
2024-07-24 14:05:55 +02:00
parent bf2356e10a
commit f9f02dfcf8

View File

@@ -1,6 +1,7 @@
import { Component, ViewChild } from '@angular/core'; import { AfterViewInit, Component, ViewChild } from '@angular/core';
import { GuiCellEdit } from '@generic-ui/ngx-grid'; import { GuiCellEdit } from '@generic-ui/ngx-grid';
import { UserTableComponent } from '../tables/user-table/user-table.component'; import { UserTableComponent } from '../tables/user-table/user-table.component';
import { RefreshService } from '../../services/refresh.service';
@Component({ @Component({
standalone: true, standalone: true,
@@ -9,8 +10,7 @@ import { UserTableComponent } from '../tables/user-table/user-table.component';
templateUrl: './user.component.html', templateUrl: './user.component.html',
styleUrl: './user.component.css' styleUrl: './user.component.css'
}) })
export class UserComponent { export class UserComponent implements AfterViewInit {
cellEditing: GuiCellEdit = { cellEditing: GuiCellEdit = {
enabled: true, enabled: true,
rowEdit: (value: any, item: any, index: number) => { rowEdit: (value: any, item: any, index: number) => {
@@ -21,7 +21,14 @@ export class UserComponent {
} }
} }
constructor(private refreshService: RefreshService) { }
ngAfterViewInit(): void {
this.refreshService.removeAll()
this.refreshService.add(() => {
this.userTable.fetchData();
});
}
@ViewChild("userTable") userTable!: UserTableComponent @ViewChild("userTable") userTable!: UserTableComponent
} }