Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit c3fed80

Browse files
authored
Merge pull request #985 from ghiscoding/bugfix/collectionAsync-on-hidden-column
fix(collectionAsync): hidden column does not load edit field selection
2 parents 1d7339b + 8e6db6c commit c3fed80

File tree

3 files changed

+2
-12
lines changed

3 files changed

+2
-12
lines changed

src/app/modules/angular-slickgrid/components/__tests__/angular-slickgrid.component.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -687,13 +687,11 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =
687687
it('should be able to load async editors with an Observable', (done) => {
688688
const mockCollection = ['male', 'female'];
689689
const mockColDefs = [{ id: 'gender', field: 'gender', editor: { model: Editors.text, collectionAsync: of(mockCollection) } }] as Column[];
690-
const getColSpy = jest.spyOn(mockGrid, 'getColumns').mockReturnValue(mockColDefs);
691690

692691
component.ngAfterViewInit();
693692
component.columnDefinitions = mockColDefs;
694693

695694
setTimeout(() => {
696-
expect(getColSpy).toHaveBeenCalled();
697695
expect(component.columnDefinitions[0].editor).toBeTruthy();
698696
expect(component.columnDefinitions[0].editor!.collection).toEqual(mockCollection);
699697
expect(component.columnDefinitions[0].internalColumnEditor!.collection).toEqual(mockCollection);
@@ -711,7 +709,6 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =
711709
renderDomElement: jest.fn(),
712710
} as unknown as Editor;
713711
const mockColDefs = [{ id: 'gender', field: 'gender', editor: { model: Editors.text, collectionAsync: promise } }] as Column[];
714-
const getColSpy = jest.spyOn(mockGrid, 'getColumns').mockReturnValue(mockColDefs);
715712
jest.spyOn(mockGrid, 'getCellEditor').mockReturnValue(mockEditor);
716713
const disableSpy = jest.spyOn(mockEditor, 'disable');
717714
const destroySpy = jest.spyOn(mockEditor, 'destroy');
@@ -721,7 +718,6 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =
721718
component.columnDefinitions = mockColDefs;
722719

723720
setTimeout(() => {
724-
expect(getColSpy).toHaveBeenCalled();
725721
expect(component.columnDefinitions[0].editor).toBeTruthy();
726722
expect(component.columnDefinitions[0].editor!.collection).toEqual(mockCollection);
727723
expect(component.columnDefinitions[0].internalColumnEditor!.collection).toEqual(mockCollection);

src/app/modules/angular-slickgrid/components/angular-slickgrid.component.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,9 +1375,8 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy {
13751375
(column.editor as ColumnEditor).disabled = false;
13761376

13771377
// find the new column reference pointer & re-assign the new editor to the internalColumnEditor
1378-
const columns = this.slickGrid.getColumns();
1379-
if (Array.isArray(columns)) {
1380-
const columnRef = columns.find((col: Column) => col.id === column.id);
1378+
if (Array.isArray(this.columnDefinitions)) {
1379+
const columnRef = this.columnDefinitions.find((col: Column) => col.id === column.id);
13811380
if (columnRef) {
13821381
columnRef.internalColumnEditor = column.editor as ColumnEditor;
13831382
}

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8088,11 +8088,6 @@ modify-values@^1.0.0:
80888088
resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022"
80898089
integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==
80908090

8091-
moment-mini@^2.24.0:
8092-
version "2.24.0"
8093-
resolved "https://registry.yarnpkg.com/moment-mini/-/moment-mini-2.24.0.tgz#fa68d98f7fe93ae65bf1262f6abb5fb6983d8d18"
8094-
integrity sha512-9ARkWHBs+6YJIvrIp0Ik5tyTTtP9PoV0Ssu2Ocq5y9v8+NOOpWiRshAp8c4rZVWTOe+157on/5G+zj5pwIQFEQ==
8095-
80968091
moment-mini@^2.29.4:
80978092
version "2.29.4"
80988093
resolved "https://registry.yarnpkg.com/moment-mini/-/moment-mini-2.29.4.tgz#cbbcdc58ce1b267506f28ea6668dbe060a32758f"

0 commit comments

Comments
 (0)