0

In angular slickgrid, I am trying to force fit column and then while disable the force fit its not setting to normal size.

Current behavior

  1. Click the force fit column button, All slickgrid column are fit into the window

  2. Again clicking(uncheck) the force fit column button, the columns are not fitting to previous width.

Expected behavior

  1. Click the force fit column button, All slickgrid column are fit into the window

  2. Again disabling the force fit button, the column need to set as previous.

Step to reproduce my case in angular slickgrid library

  1. Open the shared URL : https://ghiscoding.github.io/Angular-Slickgrid/#/resize-by-content

  2. Check the force fit column in slick grid menu, the columns resize to window size

  3. Uncheck the force fit column in slick grid menu, the columns not setting to previous size

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

Anu
  • 1
  • 1

1 Answers1

0

Please note that I'm the author of Angular-Slickgrid which is a wrapper on top of SlickGrid

The behavior you mentioned is totally normal, what Force Fit Columns does behind the scene is toggle the forceFitColumns grid option and then call the grid.autosizeColumns() method, however when you uncheck the checkbox it simply toggles back the grid option and does nothing else (it doesn't call any resize whatsoever when unchecking the option). So there is no undo, it has no knowledge of what the sizes where before you called the resize, the only thing you can do is to call for another resize

  1. call another force fit via grid.autosizeColumns();
    • which is what force fit calls too when enabled
    • it is also what Angular-Slickgrid calls one time only by default when loading the grid
  2. or call resize by content via the ResizerService

These 2 resizes are both shown in the Angular-Slickgrid you referenced and again there is no undo. When I designed Angular-Slickgrid, I only wanted to run the force fit when the page loads and never after and that is what the lib does by default (similar to enabling force fit once and disabling it right after because it does the same thing and calls grid.autosizeColumns();)

The Force Fit Columns is a legacy way of resizing columns in the current grid viewport. I never use it (except calling autosizeColumns() once after grid gets loaded), in fact I remove from the Column Picker & Grid Menu on all my grids in all my projects because it confuses people (just like you).

Note on Resize by Content feature

I'm not sure if you knew already or not, but when I created the Resize by Content, I made it optional to avoid surprises for users (opt-in). However, I did enable the feature when you double-click between 2 columns, that portion is enabled by default on all grid as you can see below.

Check the Resize by Content - Wiki for more info

enter image description here

ghiscoding
  • 12,308
  • 6
  • 69
  • 112