Fix selection

This commit is contained in:
Daniel Ponte 2024-12-30 16:23:16 -05:00
parent 84ebd7e959
commit 8c1dfd5b95
5 changed files with 20 additions and 11 deletions

View file

@ -166,6 +166,7 @@ export class CallsComponent {
'duration',
];
curPage = <PageEvent>{ pageIndex: 0, pageSize: 0 };
curLen = 0;
currentSet!: CallRecord[];
currentServerPage = 0; // page is never 0, forces load
isLoading = true;
@ -198,7 +199,7 @@ export class CallsComponent {
isAllSelected() {
const numSelected = this.selection.selected.length;
const numRows = this.curPage.pageSize;
const numRows = this.curLen;
return numSelected === numRows;
}
@ -334,6 +335,11 @@ export class CallsComponent {
);
}),
);
this.subscriptions.add(
this.callsResult.subscribe((cr) => {
this.curLen = cr.length;
}),
);
}
resetFilter() {

View file

@ -8,9 +8,8 @@ describe('IncidentComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [IncidentComponent]
})
.compileComponents();
imports: [IncidentComponent],
}).compileComponents();
fixture = TestBed.createComponent(IncidentComponent);
component = fixture.componentInstance;

View file

@ -4,8 +4,6 @@ import { Component } from '@angular/core';
selector: 'app-incident',
imports: [],
templateUrl: './incident.component.html',
styleUrl: './incident.component.scss'
styleUrl: './incident.component.scss',
})
export class IncidentComponent {
}
export class IncidentComponent {}

View file

@ -60,4 +60,4 @@ form {
.filterBox {
flex: 1 1 300px;
}
}

View file

@ -85,10 +85,11 @@ export class IncidentsComponent {
incsResult = new BehaviorSubject(new Array<IncidentRecord>(0));
@ViewChild('paginator') paginator!: MatPaginator;
count = 0;
curLen = 0;
page = 0;
perPage = 25;
pageSizeOptions = [25, 50, 75, 100, 200];
columns = ['startTime', 'endTime', 'name', 'numCalls', 'edit'];
columns = ['select', 'startTime', 'endTime', 'name', 'numCalls', 'edit'];
curPage = <PageEvent>{ pageIndex: 0, pageSize: 0 };
currentSet!: IncidentRecord[];
currentServerPage = 0; // page is never 0, forces load
@ -119,7 +120,7 @@ export class IncidentsComponent {
isAllSelected() {
const numSelected = this.selection.selected.length;
const numRows = this.curPage.pageSize;
const numRows = this.curLen;
return numSelected === numRows;
}
@ -238,6 +239,11 @@ export class IncidentsComponent {
);
}),
);
this.subscriptions.add(
this.incsResult.subscribe((cr) => {
this.curLen = cr.length;
}),
);
}
resetFilter() {