Skip to content

Commit

Permalink
fix select / deselect all bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lyubov-voloshko committed Jul 26, 2024
1 parent a1fd3a4 commit 723ef26
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h3 class='mat-subheading-2'>Rocketadmin can not find any tables</h3>
[filterComparators]="comparators"
[name]="selectedTableName"
[table]="dataSource"
[rowSelection]="selection"
[selection]="selection"
[connectionID]="connectionID"
[accessLevel]="currentConnectionAccessLevel"
(openFilters)="openTableFilters($event)"
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/components/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -34,6 +35,7 @@ export class DbTableComponent implements OnInit {
@Input() connectionID: string;
@Input() activeFilters: object;
@Input() filterComparators: object;
@Input() selection: SelectionModel<any>;

@Output() openFilters = new EventEmitter();
@Output() openPage = new EventEmitter();
Expand All @@ -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[] = [];
Expand All @@ -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;

Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit 723ef26

Please sign in to comment.