Skip to content

Commit

Permalink
Fix Multi Select issues in table
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishal committed Jul 22, 2024
1 parent 83dd074 commit 38ebefb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
<ng-container *ngIf="multiSelectionMode" matColumnDef="select">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let row">
<mat-checkbox [value]="row[rowID]" (change)="onCheckboxClick(row, $event)"></mat-checkbox>
<mat-checkbox [value]="row[rowID]" [checked]="isChecked(row)" (change)="onCheckboxClick(row, $event)"></mat-checkbox>
</td>
</ng-container>
<ng-container *ngFor="let dCol of fields$" [matColumnDef]="dCol.config.name">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ interface ListViewProps {
presets?: any;
reorderFields: string | boolean;
grouping: string | boolean;
value: any;
readonlyContextList: any;
}

export class Group {
Expand Down Expand Up @@ -505,6 +507,13 @@ export class ListViewComponent implements OnInit, OnDestroy {
}
}

isChecked(rowIn): any {
const initialVal = false;
return this.configProps$?.readonlyContextList?.reduce((acc, currRow) => {
return acc || rowIn[this.rowID] === currRow[this.rowID];
}, initialVal);
}

fieldOnChange(row) {
const value = row[this.rowID];
const reqObj = {};
Expand Down

0 comments on commit 38ebefb

Please sign in to comment.