In angular slickgrid, I am trying to implement force fit column & auto resize column feature with two button click. When I click force fit button, the column of slickgrid fit into the window size. And when I click the auto resize button, disable the force fit and resize the column based on cell content. For this requirement I have implemented following code (snippet). I have checked the same in angular slickgrid demo page, this issue occurred in the page. Kindly suggest the way to fix this issue.
Code Snippet:
public gridOptions: GridOption = {
gridMenu: {
hideForceFitButton:true // To hide the force fit checkbox in grid menu
}
}
onForceFitColumnClick() {
this.angularGridInstance.slickGrid.setOptions({ forceFitColumns: true })
}
onAutoResizeColumnClick() {
if (this.angularGridInstance.slickGrid.getOptions()['forceFitColumns']) {
this.angularGridInstance.slickGrid.setOptions({ forceFitColumns: false })
}
this.angularGridInstance.resizerService.resizeColumnsByCellContent(true);
}
Current behavior
1. Click the force fit column button, All slickgrid column are fit into the window
2. Click the auto resize column button, the slickgrid column not resized based on cell content
Expected behavior
1. Click the force fit column button, All slickgrid column are fit into the window
2. Click the auto resize column button, the slickgrid column should resized based on cell content
Step to reproduce my case in angular slickgrid library
- Open the shared URL : https://ghiscoding.github.io/Angular-Slickgrid/#/resize-by-content
- Resize any column of slickgrid by dragging end of column to check the auto resize feature.
- Now click the "Resize by Cell Content" button. Now the resize by cell content working fine.
- Now click the grid menu and check the force fit column, and again open grid menu and uncheck the force fit column. Now the force fit column disable.
- Now click the "Resize by Cell Content" button. Now the resize by cell content will not work as expect.
Software Version
Angular : 13.3.9
Angular-Slickgrid : 4.3.1
TypeScript : 4.6.4
Operating System : Windows 11
Node : 14.18.3
NPM : 6.14.15