Skip to content

Commit f352655

Browse files
authored
Merge pull request #9224 from IgniteUI/rkaraivanov/fix-9223
fix(grid): invalid checkbox state in edit mode
2 parents cddbb50 + feaf011 commit f352655

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

projects/igniteui-angular/src/lib/grids/cell.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,12 @@
9090
</igx-input-group>
9191
</ng-container>
9292
<ng-container *ngIf="column.dataType === 'boolean'">
93+
<!-- The additional [checked] binding is needed as after the initial call of the checked getter
94+
it is never called again as no change detection is triggered in the grid after that, resulting in wrong
95+
rendered state of the checkbox. -->
9396
<igx-checkbox
9497
[(ngModel)]="editValue"
98+
[checked]="editValue"
9599
[igxFocus]="true"
96100
[disableRipple]="true"
97101
></igx-checkbox>

projects/igniteui-angular/src/lib/grids/grid/grid-cell-editing.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ describe('IgxGrid - Cell Editing #grid', () => {
164164
const editTemplate = cellDomBoolean.query(By.css('.igx-checkbox'));
165165
expect(editTemplate).toBeDefined();
166166
expect(cell.value).toBe(true);
167+
expect(cell.nativeElement.querySelector('.igx-checkbox--checked')).toBeInstanceOf(HTMLElement);
167168

168169
editTemplate.nativeElement.click();
169170
fixture.detectChanges();
@@ -173,6 +174,7 @@ describe('IgxGrid - Cell Editing #grid', () => {
173174

174175
expect(cell.editMode).toBe(false);
175176
expect(cell.value).toBe(false);
177+
expect(cell.nativeElement.querySelector('.igx-checkbox--checked')).toBeNull();
176178
}));
177179

178180
it('edit template should be according column data type -- date', () => {

0 commit comments

Comments
 (0)