diff --git a/frontend/src/app/components/dashboard/dashboard.component.html b/frontend/src/app/components/dashboard/dashboard.component.html index 1d9945c0..53d0f609 100644 --- a/frontend/src/app/components/dashboard/dashboard.component.html +++ b/frontend/src/app/components/dashboard/dashboard.component.html @@ -61,7 +61,7 @@

Rocketadmin can not find any tables

[filterComparators]="comparators" [name]="selectedTableName" [table]="dataSource" - [rowSelection]="selection" + [selection]="selection" [connectionID]="connectionID" [accessLevel]="currentConnectionAccessLevel" (openFilters)="openTableFilters($event)" diff --git a/frontend/src/app/components/dashboard/dashboard.component.ts b/frontend/src/app/components/dashboard/dashboard.component.ts index 4d027d65..2a06d8d9 100644 --- a/frontend/src/app/components/dashboard/dashboard.component.ts +++ b/frontend/src/app/components/dashboard/dashboard.component.ts @@ -261,6 +261,8 @@ export class DashboardComponent implements OnInit, OnDestroy { const filters = JsonURL.stringify( this.filters ); + this.selection.clear(); + this.getRows(); this.router.navigate([`/dashboard/${this.connectionID}/${this.selectedTableName}`], { queryParams: { diff --git a/frontend/src/app/components/dashboard/db-table/db-table.component.ts b/frontend/src/app/components/dashboard/db-table/db-table.component.ts index 684c066e..e771fbfe 100644 --- a/frontend/src/app/components/dashboard/db-table/db-table.component.ts +++ b/frontend/src/app/components/dashboard/db-table/db-table.component.ts @@ -9,6 +9,7 @@ import { MatDialog } from '@angular/material/dialog'; import { MatPaginator } from '@angular/material/paginator'; import { MatSort } from '@angular/material/sort'; import { NotificationsService } from 'src/app/services/notifications.service'; +import { SelectionModel } from '@angular/cdk/collections'; import { TableStateService } from 'src/app/services/table-state.service'; import { merge } from 'rxjs'; import { normalizeTableName } from '../../../lib/normalize' @@ -34,6 +35,7 @@ export class DbTableComponent implements OnInit { @Input() connectionID: string; @Input() activeFilters: object; @Input() filterComparators: object; + @Input() selection: SelectionModel; @Output() openFilters = new EventEmitter(); @Output() openPage = new EventEmitter(); @@ -45,7 +47,7 @@ export class DbTableComponent implements OnInit { @Output() activateActions = new EventEmitter(); public tableData: any; - public selection: any; + // public selection: any; public columns: Column[]; public displayedColumns: string[] = []; public columnsToDisplay: string[] = []; @@ -67,10 +69,6 @@ export class DbTableComponent implements OnInit { if (value) this.tableData = value; } - @Input() set rowSelection(value){ - if (value) this.selection = value; - } - @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; @@ -230,7 +228,7 @@ export class DbTableComponent implements OnInit { /** Whether the number of selected elements matches the total number of rows. */ isAllSelected() { - return this.paginator.pageSize === this.selection.selected.length; + return this.tableData.rowsSubject.value.length === this.selection.selected.length; } /** Selects all rows if they are not all selected; otherwise clear selection. */