Skip to content

Commit

Permalink
Merge pull request #314 from ghiscoding/bugfix/custom-grid-view-reload
Browse files Browse the repository at this point in the history
fix(resize): columns reposition not coming back after grid setOptions
  • Loading branch information
ghiscoding authored Apr 21, 2021
2 parents 515a072 + d316db9 commit 7e4c417
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"lint": "eslint packages/** --ext .ts",
"test": "npx jest --runInBand --coverage=true --config ./test/jest.config.js",
"test:ci": "npx jest --runInBand --coverage=true --ci --config ./test/jest.config.js",
"test:watch": "npx jest --watch --config ./test/jest.config.js"
"test:watch": "cross-env TZ='America/New_York' jest --watch --config ./test/jest.config.js"
},
"comments": {
"create-new-version": "To create a new version with Lerna, run the following scripts (1) 'bundle', (2) 'new-version' and (3) 'publish' to finally push to NPM."
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ const mockGrid = {
updateRow: jest.fn(),
render: jest.fn(),
registerPlugin: jest.fn(),
reRenderColumns: jest.fn(),
resizeCanvas: jest.fn(),
setColumns: jest.fn(),
setHeaderRowVisibility: jest.fn(),
Expand Down Expand Up @@ -623,7 +624,7 @@ describe('Slick-Vanilla-Grid-Bundle Component instantiated via Constructor', ()

expect(component.gridOptions.autoCommitEdit).toEqual(false);
// expect(component.gridOptions.autoResize.bottomPadding).toEqual(50 + DATAGRID_FOOTER_HEIGHT); // calculated by the lib
expect(setOptionSpy).toBeCalledWith(component.gridOptions);
expect(setOptionSpy).toBeCalledWith(component.gridOptions, false, true);
expect(sharedOptionSpy).toBeCalledWith(component.gridOptions);
});

Expand All @@ -638,7 +639,7 @@ describe('Slick-Vanilla-Grid-Bundle Component instantiated via Constructor', ()
component.dataset = mockData;

expect(component.gridOptions.autoCommitEdit).toEqual(false);
expect(setOptionSpy).toBeCalledWith(component.gridOptions);
expect(setOptionSpy).toBeCalledWith(component.gridOptions, false, true);
expect(sharedOptionSpy).toBeCalledWith(component.gridOptions);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ export class SlickVanillaGridBundle {
}
if (this.sharedService?.gridOptions && this.slickGrid?.setOptions) {
this.sharedService.gridOptions = mergedOptions;
this.slickGrid.setOptions(mergedOptions);
this.slickGrid.setOptions(mergedOptions, false, true); // make sure to supressColumnCheck (3rd arg) to avoid problem with changeColumnsArrangement() and custom grid view
this.slickGrid.reRenderColumns(true); // then call a re-render since we did supressColumnCheck on previous setOptions
}
this._gridOptions = mergedOptions;
}
Expand Down

0 comments on commit 7e4c417

Please sign in to comment.