feat: RefreshService zur Benutzertabelle in der Groups-Komponente hinzugefügt und integriert

This commit is contained in:
Developer 02 2024-07-25 00:44:37 +02:00
parent 4f4b9711c7
commit 21ab7b5f32

View File

@ -14,13 +14,15 @@ import { GuiSelectedRow } from '@generic-ui/ngx-grid';
}) })
export class GroupComponent implements AfterViewInit { export class GroupComponent implements AfterViewInit {
initWithoutData = () => { } initWithoutData = () => { }
private sGroupId = null;
constructor(private refreshService: RefreshService) { } constructor(private refreshService: RefreshService) { }
ngAfterViewInit(): void { ngAfterViewInit(): void {
this.refreshService.removeAll() this.refreshService.removeAll()
this.refreshService.add(() => { this.refreshService.add(() => {
this.groupTable.fetchData(); this.groupTable.fetchData();
if(this.sGroupId)
this.userTable.fetchDataByGroupId(this.sGroupId);
}); });
} }
@ -28,7 +30,10 @@ export class GroupComponent implements AfterViewInit {
@ViewChild("userTable") userTable!: UserTableComponent; @ViewChild("userTable") userTable!: UserTableComponent;
groupsOnSelectedRows = (rows: GuiSelectedRow[]) => { groupsOnSelectedRows = (rows: GuiSelectedRow[]) => {
const groupId = rows[0].source.id; if(rows.length > 0){
this.userTable.fetchDataByGroupId(groupId); this.sGroupId = rows[0].source.id;
if(this.sGroupId)
this.userTable.fetchDataByGroupId(this.sGroupId);
}
} }
} }