Is there a way to dynamically, programmatically change column widths in ui-grid for Angularjs?
I tried changing $ scope.gridOptions.columnDefs [i] .width, but this has no effect.
I ask because I have a Ui-grid-resize-columns directive that allows the user to resize columns that are initially set as a percentage width. But as soon as the user makes some kind of manual modification, the sizes of the columns become static, no longer grow and do not shrink with the total width of the table.
I would like to add an “autofit” button that will allow the user to restore the definition of the column size in percent (based on their manually set proportions), which are up to 100%. Ideally, the columns will then begin to adapt to the table resizing again.
I can just see how the user presses F5 regularly to get this effect (I would!), Unknowingly causing the whole page to reload from scratch, unreasonably requiring significant server resources. I think one of the unpleasant alternatives is to make them static from the start, eliminating this temptation!
Dev93 source
share